In C #, you can define a session variable as follows:
Session["userame"]= txtusername.Text;
where txtusername is the text box. On another page you can name it:
string usrname = Session["username"].ToString();
To check whether a user is registered or not, on a specific page; you will need to check if this session is empty or not. If the session is zero, redirect the user to the login page, otherwise he / she will be able to view the page. The same logic applies to all pages on which you want to implement session verification. Example (in the Page_Load event):
if (Session["username"] == null) Response.Redirect ("Login.aspx");
Hope this helps ... :)
source share