Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

In the master page i have a link for "login", after login i need this to be changed to "logout", is this possible and how?

Thanks,
Rami
Posted

1 solution

With few details, such as language, authentication proivders, etc... ill assume its the standard ASP.NET/C# stance :)

This could be achieved by checking if the user is authenicated and if they are, change the text and url of the control.

Using ASP.NET Users/Roles, this can be done by:

C#
if(HttpContext.Current.User.Identity.IsAuthenticated)
{
// change text to 'logout' and update URL
}
else
{
// change text to 'login' and update URL
}



-DB
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900