Auto-Login using cookies

T

thecoolone

Im doing a project on Internet Banking.
I have created a login page and im using forms authorization (done in
web.config) and in the login page i have the following code

"FormsAuthentication.SetAuthCookie(user,true);
Response.Redirect("welcome.aspx");"

My problem is that im using a session variable
"Session["name"]=TextBox1.Text;"
to query the database to get details of a particular user.

So even though i have set a persistent cookie, whenever i shutdown and
restart the browser im unable to auto login and check the other pages
without again signing in again coz of the session variable not being
initialized.

So is there a way by which i can enter and retrieve a variable say
"username" from the cookie (i mean the same cookie which is set by
FormsAuthentication.SetAuthCookie) and use that to auto-login and query
the database.

any help is welcomed.
thanx in advance


P.S: Im using C# as the Page language.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top