FormsAuthentication.Signout is not working

CahitEy
CahitEy used Ask the Experts™
on
I tryed all this methods given below : but i could not able to complete sign out please help me
Response.Cache.SetCacheability(HttpCacheability.NoCache)
        Response.Cookies.Item(FormsAuthentication.FormsCookieName).Expires = Date.Now.AddDays(-1)
        Response.Cookies.Item(FormsAuthentication.FormsCookieName).Value = "crap"
        FormsAuthentication.SignOut()
        Session.Abandon()
        Session.Clear()
        Session.RemoveAll()
        Dim authTicket As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, _
User.Identity.Name, DateTime.Now, DateTime.Now.AddMinutes(-20), False, "")
        Response.Cache.SetCacheability(HttpCacheability.NoCache)
        Response.Cache.SetExpires(Now.AddSeconds(-1))
        Response.Cache.SetNoStore()
        Response.AppendHeader("Pragma", "no-cache")
        Me.Response.Expires = 0
        Me.Response.Cache.SetCacheability(HttpCacheability.NoCache)
 
        Session.Abandon()
        FormsAuthentication.SignOut()
        Response.Cookies(FormsAuthentication.FormsCookieName).Expires = DateAdd(DateInterval.Year, -1, DateTime.Now)

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
I'm sure this is totally out of scope, but it might help in the future, if you think you would implement it...

http://www.codeproject.com/KB/web-security/RolesFormsAuthorization.aspx

Author

Commented:
I modified a little bit the code and it worked for me thanks it helped me so much

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial