formsauthentication

G

Grant Merwitz

Hi, i am using forms authentication in an ASP.NET project

I am setting the Forms authentication cookie by using:
FormsAuthentication.RedirectFromLoginPage(UserName.Text, false);

Now when i review my trace on my page, there are two cookies created that
look identical.
When i FormsAuthentication.SignOut() they both dissappear.

Any ideas as to why two cookies are created?

TIA
 
J

Janaka

Grant,

Is this a local app you are debugging or on the live server? Try setting
the domain property of the cookie. That may clear up the double cookie
problem.

Janaka
 
J

Janaka

Try setting it this way: I've set the cookie to timeout after 20 minutes
but you can change this

FormsAuthenticationTicket authTicket = new
FormsAuthenticationTicket(tbUserName.Text, false, 20);

// Encrypt and store the ticket

string encryptTicket = FormsAuthentication.Encrypt(authTicket);

HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName,
encryptTicket);

authCookie.Domain = ConfigurationSettings.AppSettings["domain"];

// Redirect

Response.Cookies.Add(authCookie);

Response.Redirect(FormsAuthentication.GetRedirectUrl(tbUserName.Text,
false));
 

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,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top