Link to home
Start Free TrialLog in
Avatar of CahitEy
CahitEy

asked on

FormsAuthentication.Signout is not working

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

ASKER CERTIFIED SOLUTION
Avatar of kworks
kworks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CahitEy
CahitEy

ASKER

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