Advertise with us

Update the Login Control

Posted by  ravi kumar
 2452  View(s)
Ratings:
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
  1. Re: Update the Login Control

    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.

      Modified On Mar-29-2018 04:45:07 AM

Answer