prevent multiple login in asp.net without database concepts
I am using Form Authentication in my application using Asp.net 4.0.
1. Browse http://localhost/Login.aspx in IE.
2. Fill username and password.
3. OnClick on Login button ,then redirect to home.aspx.
4. Open new tab and browse same URL http://localhost/Login.aspx without closing already logged in tab.
5. Here i want to validate the user. If the user already logged in that should redirect to home.aspx.
6. If the user not yet loggedin, that redirect to Login.aspx
Page_Load()
{
// here i want to validate URL http://localhost/Login.aspx wheather it is loggedin or not
// if yes
// Response.redirect("Home.aspx");
// else
// Response.redirect("Login.aspx");
}
btnLogin_Click()
{
username and password verified here.
FormsAuthentication.SetAuthCookie(txtUsername.text, false);
FormsAuthenticationTicket ticket1 genearated here
Encrypt the cookie using the machine key for secure transport
Set the cookie's expiration time to the tickets expiration time
if true
Response.redirect("Home.aspx");
else
Response.redirect("Login.aspx");
}
Thanks in advance.....