UPDATE THE LOGIN CONTROL

ravi kumar

Total Post:9

Points:63
Posted by  ravi kumar
 1787  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. Chris Anderson

    Post:65

    Points:455
    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!