Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
- <%
- if (Request.IsAuthenticated) {
- %>
- Welcome <b><%= Html.Encode(Page.User.Identity.Name) %></b>!
- [ <%= Html.ActionLink("Log Off", "LogOff", "Account") %> ]
- <%
- }
- else {
- %>
- [ <%= Html.ActionLink("Log On", "LogOn", "Account") %> ]
- <%
- }
- %>
- <%= Html.LoginStatus() =>
- /Views/Shared/LoginStatus.Anonymous.ascx
- /Views/Shared/LoginStatus.Authenticated.ascx
- <asp:LoginView Runat="Server">
- <LoggiedInTemplate>
- Welcome, <%= Html.Encode(Model.UserName) %>!
- <button>Sign Out</button>
- </LoggedInTemplate>
- <AnonymousTemplate>
- <button>Sign In</button> | <button>Join Now!</button>
- </AnonymousTemplate>
- </asp:LoginView>
- public ActionResult ShowAPage()
- {
- if(!HttpContext.User.Identity.IsAuthenticated)
- {
- return RedirectToRoute("ShowLoginPage")
- }
- return View();
- }
- public ActionResult ShowAPage()
- {
- if(!HttpContext.User.Identity.IsAuthenticated)
- {
- return View("ShowAPageView", "LoggedInMasterPageName");
- }
- return View("ShowAPageView", "LoggedOutMasterPageName");
- }
Add Comment
Please, Sign In to add comment