Loading
  1.  
  2. Partial Class Logout
  3.     Inherits System.Web.UI.Page
  4.  
  5.     Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
  6.  
  7.         ' Catch the Site URL first, we don't want to forget where to redirect them to!
  8.         Dim strSiteURL As String = Session("SiteURL")
  9.  
  10.         ' Delete all cookies
  11.         If (Not Request.Cookies("PrecisionDecisionsPortal") Is Nothing) Then
  12.             If Session("Environment") <> "DEV" Then Response.Cookies("PrecisionDecisionsPortal").Domain = ".precisiondecisions.co.uk"
  13.             Response.Cookies("PrecisionDecisionsPortal").Expires = DateTime.Now.AddDays(-1)
  14.             Response.Cookies("acopendivids").Expires = DateTime.Now.AddDays(-1)
  15.             Response.Cookies("acgroupwithpersist").Expires = DateTime.Now.AddDays(-1)
  16.         End If
  17.  
  18.         ' Kill all sessions
  19.         Session.RemoveAll()
  20.         Session.Abandon()
  21.  
  22.         ' Redirect them back to the homepage
  23.         Response.Redirect(strSiteURL)
  24.  
  25.     End Sub
  26.  
  27. End Class

Comments