我是一名新开发人员,我被分配了解决我们的注销功能无法正常工作的任务.我已经尝试了所有可以找到的方法.下面是我保留的日志,其中包括我使用过的方法.
在CommonHeader.ascx表单中添加了一个注销按钮
已经在logout.aspx.vb表单中尝试了许多方法来使其结束或清除会话,但它们都不起作用.
一个.logout.aspx.vb形式中定义的ClearSession子例程:
Session("Variable") = ""
FormsAuthentication.SignOut()
Session.RemoveAll()
Session.Abandon()
Session.Clear()
Run Code Online (Sandbox Code Playgroud)
湾 还将其添加到Page_Load子例程的顶部:
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache)
HttpContext.Current.Response.Cache.SetNoServerCaching()
HttpContext.Current.Response.Cache.SetNoStore()
Run Code Online (Sandbox Code Playgroud)
C.还将ClearSession子例程更改Session.Contents.Remove("Variable")为Session("Variable") = ""
这些方法都不起作用.我们使用Siteminder,我一直想知道这是否是问题的根源.我在清除使用Siteminder的会话时找不到任何内容.另请注意,此应用程序使用Visual Studio 2003编码.
这是我在ascx文件中使用的按钮的代码:
athp:TopNavText Title ="Log Out"NavigateUrl ="logout.aspx"Target ="_ top"/
然后在"logout.aspx"表单上,我尝试使用上述方法之一或每种方法的组合.这是我触摸它之前的代码:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ClearSession()
Response.Redirect("login.aspx")
End Sub
Public Sub ClearSession()
Session("Variable") = ""
End Sub
Run Code Online (Sandbox Code Playgroud)