Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
can someone tell me how can do this???
Posted

write this code in Masterpage.

C#
if (Session["UserName"] != null)
{
    //Retrieving UserName from Session
    lblWelcome.Text = "Welcome : " + Session["UserName"];
}
else
{
 Response.Redirect("Login.aspx");
}
 
Share this answer
 
Comments
sumit kausalye 7-Nov-12 2:05am    
when timeout expire or session is expire then it will redirect page to login form..sir
vivektiwari97701 7-Nov-12 2:11am    
just think without any event from client side how your code will work ??
u can do 1 thing if your session tome is 20 min just write code for auto refresh in every 22 min.
 
Share this answer
 
v4
Comments
Yatin chauhan 7-Nov-12 3:15am    
If you need that when your session is timeout or expire then u must have to refresh your page.

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