Common Security
Common_Security_VBNet\Login.aspx.vb
' Copyright 2011 ESRI
' 
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
' 
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
' 
' See the use restrictions.
' 


Imports Microsoft.VisualBasic
Imports System
Public Partial Class Login
  Inherits System.Web.UI.Page
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    ' Check whether the user has just clicked the Logout link
    ' on the Default page and has been redirected to the Login.aspx
    ' page. If so, we remove some session objects so that if the
    ' user logs back in, no evidence of the previous session is present.
    If Not Session("keysToRemove") Is Nothing Then
      Dim keysToRemove As System.Collections.Generic.List(Of String) = CType(Session("keysToRemove"), System.Collections.Generic.List(Of String))

      For Each keyToRemove As String In keysToRemove
        Session.Remove(keyToRemove)
      Next keyToRemove
    End If

    ' Remove the session object storing which keys to remove
    Session.Remove("keysToRemove")
  End Sub
End Class