views:

20

answers:

2

If I call

FormsAuthentication.SignOut();

with a user logged in (with createPersistentCookie set to false on sign in) should I expect

HttpContext.Current.User.Identity.IsAuthenticated

to be false?

It isn't, and Identity.Name still has a value. Is this right?

If this is normal behaviour, what do I need to do to remove all trace of a logged in user?

Edit: Is there someway to do what is necessary without doing a Response.Redirect?

+1  A: 

The FormsAuthentication.SignOut method removes the forms-authentication ticket from the browser, so you need to first redirect and then query the HttpContext.Current.User.Identity.IsAuthenticated property.

Darin Dimitrov
is redirecting the only option?
Andrew Bullock
Well, as you are calling the `FormsAuthentication.SignOut` method yourself you already know in the current request that the user has been signed out. As far as the subsequent requests are concerned the cookie will be cleared and the `HttpContext.Current.User.Identity.IsAuthenticated` property will be reflected.
Darin Dimitrov
+1  A: 

Call

Response.Redirect(FormsAuthentication.LoginUrl);
VyvIT