Home > DeveloperSection > Forums > Update the Login Control
ravi kumar

Total Post:9

Points:63
Posted on    November-01-2011 11:50 PM

 ASP.NET MVC ASP.NET MVC 
Ratings:


 1 Reply(s)
 1501  View(s)
Rate this:
How to update the Login control to display Login user details once logged in successfully.i.e. once Login into the Login form Login control should be changed as Logoff control and diplay the Login username details


Chris Anderson
Chris Anderson

Total Post:65

Points:455
Posted on    November-02-2011 12:42 AM

Hi,

You can create user control to change the login to logoff.
For eg.

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%
    if (Request.IsAuthenticated) {
%>
        Welcome <b><%: Page.User.Identity.Name %></b>!
        [ <%: Html.ActionLink("Log Off", "LogOff", "Account") %> ]
<%
    }
    else {
%>
        [ <%: Html.ActionLink("Log On", "LogOn", "Account") %> ]
<%
    }
%>

You can also refer demo mvc application provided default in visual studio.

Don't want to miss updates? Please click the below button!

Follow MindStick