TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kalai
NA
335
39.6k
prevent multiple login in asp.net without database concepts
May 5 2014 1:22 AM
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.....
Reply
Answers (
1
)
Code for search in grid
hiding JS code from search engine crawling in asp.net MVC