Click here to Skip to main content
15,887,895 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am developing a web site for test and forum in ASP.NET. I want to maintain user login status through out whole website till user logout. User can login any time, not necessary at a time when he opens web site. I have so many pages, so is there any easy way to check weather user is logged in or not on each page and display his status accordingly on each page.


Please help to solve my problem.

Thanks.
Posted
Comments
Sandeep Mewara 31-Mar-13 5:37am    
I am confused. Would not a a simple session post login do what you are looking for? Where is the trouble?
Rakesh6906 31-Mar-13 11:29am    
Have you tried Session????

1 solution

use Session like this


Add a logon button click event

C#
public void Logon_Click(object sender,EventArgs e)
{
 if(User.IsValid(txtUserName.Text,txtPassword.Text))
 {
   Session["User"] = txtUserName.Text;
 }
}



then use Session["User"] anywhere you want in the application.
 
Share this answer
 
v3

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