mir*_*rza 4 .net asp.net logout login-control
我使用LoginControl登录到我的网站asp.net,但是当注销使用登录状态或session.Abandon或.sign out时,有白色退格,我的主页被加载而且不安全.
请帮助我在我的项目中使用realy logout.
使用FormsAuthentication.SignOut();
如下:
protected void LogoutButton_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
Response.Redirect("~/Login.aspx");
}
Run Code Online (Sandbox Code Playgroud)
我找到了一个在我的母版页中使用的解决方案
if (Membership.GetUser() != null)
.....
else Response.Redirect("Login.aspx")
Run Code Online (Sandbox Code Playgroud)
以及注销按钮的代码隐藏:
FormsAuthentication.SignOut();
Response.Redirect("Login.aspx");
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助!
归档时间: |
|
查看次数: |
34261 次 |
最近记录: |