Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Please help me how to create login status in masterpage that will show 'LOGOUT' when logged in and 'LOGIN' when logged out??
Posted
Updated 5-Mar-12 0:09am
v2
Comments
Ganesan Senthilvel 5-Mar-12 5:48am    
Provide more details about the error.
Mukunda Raj 5-Mar-12 5:55am    
ERROR means either it will show 'LOGIN' status even after logged in or it will show 'LOGOUT' status even after logging out....

Instead of solving error provide me new code please??
Anuja Pawar Indore 5-Mar-12 5:58am    
Not clear
Mukunda Raj 5-Mar-12 6:08am    
Please provide me Login status code using Asp.net web application(C#)...?
Mohd Imran Saifi 5-Mar-12 6:48am    
If you Use Link Button,
the rename the link button at clicking;

means:-

when logout :- just rename it with
linkButton1.text="Login";
and clear the cookie and session.
Then it will Convert to login.

when Login :- just rename it with
linkButton1.text="Logout";

and on PageLoad() event

check ur session and cookie :
if it is then then u R Logged in.
and rename:- linkButton1.text="Logout";

by Default Take Link Button text= Login.

Or Else just Upload Your coding or Just Masterpage .

Have a look at ASP.Net membership and security. Google this, there are 1000's of results.

http://www.4guysfromrolla.com/articles/120705-1.aspx[^]

There are already controls that do exactly what you want

http://msdn.microsoft.com/en-us/library/ms178329.aspx[^]

i.e. the Login Status control[^]
 
Share this answer
 
If you Use Link Button,
the rename the link button at clicking;

means:-
when logout :- just rename it with
C#
linkButton1.text="Login";

and clear the cookie and session.
Then it will Convert to login.
when Login :- just rename it with
C#
linkButton1.text="Logout";

and on PageLoad() event
check ur session and cookie :
if it is then then u R Logged in.
and rename:-
C#
linkButton1.text="Logout";

by Default Take Link Button text= Login.

Or Else just Upload ur coding or Just Masterpage .
 
Share this answer
 
v2
After login hope you must keep userid in session

then in master page check if(Session["userId"]!=null)
means u are logged in then change the
linkbutton text ="Logout" <br />
else "Login"
 
Share this answer
 
v2

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