我在Web.config中使用身份验证的配置
<authentication mode="Forms">
<forms name=".LogonCookie" loginUrl="logon.aspx" timeout="10000"/>
</authentication> <authorization>
<deny users="?"/>
</authorization><sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="5"
/>然后在logon.aspx中:
session("name")=txtUserName.text
If Request.Params("ReturnUrl") = Nothing Then
FormsAuthentication.SetAuthCookie(Session("Name"), False)
Response.Redirect("index.aspx")
Else
FormsAuthentication.RedirectFromLoginPage(Session("name"), False)
End If
我现在是想在Session超时后,自动跳转到logon.aspx
现在的运行结果是,session超时后不自动跳转,且对session("name")的引用为空串。如何改造才能达到我要的效果?
<authentication mode="Forms">
<forms name=".LogonCookie" loginUrl="logon.aspx" timeout="10000"/>
</authentication> <authorization>
<deny users="?"/>
</authorization><sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="5"
/>然后在logon.aspx中:
session("name")=txtUserName.text
If Request.Params("ReturnUrl") = Nothing Then
FormsAuthentication.SetAuthCookie(Session("Name"), False)
Response.Redirect("index.aspx")
Else
FormsAuthentication.RedirectFromLoginPage(Session("name"), False)
End If
我现在是想在Session超时后,自动跳转到logon.aspx
现在的运行结果是,session超时后不自动跳转,且对session("name")的引用为空串。如何改造才能达到我要的效果?
FormsAuthentication.RedirectFromLoginPage(username,CheckBox1.Checked);
登陆,
通过
if(Context.Request.IsAuthenticated==true)
来判断验票是否存在
FormsAuthentication.SignOut();
Response.Redirect(@"xxxxx.aspx", false);
return;