Signout does not signout.

  • Thread starter Thread starter craigkenisston
  • Start date Start date
C

craigkenisston

So, I have this code : (AspNet 1.1)

FormsAuthenticationTicket authTkt = new FormsAuthenticationTicket(1,
_username,
DateTime.Now,
DateTime.Now.AddMinutes(60),
true,
userdata);

string encTicket = FormsAuthentication.Encrypt(authTkt);
HttpCookie authCookie = new
HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
// authCookie.Domain = "mysite.com";
// authCookie.Path = "/";
Response.Cookies.Add(authCookie);

When I call FormsAuthentication.SignOut(); it does work.
However, since I use subdomains I have to use the commented lines
..Domain and .Path, in order to the cookie work site wide. So, I
uncomment those lines and run my sample again. Now I click the logout
button in my site, which calls formsAuthentication.SignOut, but it does
not signout ! The user still authenticated !
What's happening here ? I have no idea.
 
It seems that simply, the cookie is not being removed.
So, the question is, why the cookie is not being deleted?
 
And the answer is because SignOut can't handle domain wide cookies !!
:)
 

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

Back
Top