Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Remember Me" with asp.net web pages

I realize that this question may have been asked before, but I can't find anything that matches my situation exactly.

I created a website using the WebMail helper in ASP.Net web pages (not web forms) and WebMatrix. Users are required to login to the website, and there is a "Remember me" box that (in theory) will keep the user logged in until he/she chooses to log out. The website does keep users logged in if they close the browser and reopen it within 20-30 minutes. However, after 20-30 minutes of not accessing the website, the user is logged out. (As an aside, this problem seems to exist even with the WebMatrix template "Starter Site".)

I've tried multiple solutions, many of which were posted on Stack Overflow, but nothing seems to work.

like image 912
CarolK Avatar asked Aug 06 '13 14:08

CarolK


1 Answers

You can manually create a cookie(never expiring) containing a GUID which is mapped to your user. When user makes a GET to your user login page, you can read that cookie and check the guid and authenticate the user. check the links

http://msdn.microsoft.com/en-us/library/ms178194(v=vs.100).aspx

http://msdn.microsoft.com/en-us/library/78c837bd(v=vs.100).aspx

http://www.codeproject.com/Articles/31914/Beginner-s-Guide-To-ASP-NET-Cookies

like image 92
Ktt Avatar answered Oct 05 '22 23:10

Ktt