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

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top