我需要在 asp.net 网站中创建一个登录页面。我在 web.config 文件中声明了这段代码:
<location path="Login.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
<system.web><authentication mode="Forms">
<forms name="MyAppCookie" loginUrl="Login.aspx" protection="All" timeout="30" defaultUrl="Managment.aspx" ></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization><system.web>
我在 Managment.aspx 中有一个按钮可以退出,它运行以下代码:
protected void Exit_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
}
一切都很好,但是当我尝试使用退出按钮注销时,我给出了这个错误:
但是我没有在地址栏中指定的帐户文件夹!我在网站根目录中只有一个 Login.aspx 文件。我希望通过单击此按钮系统将控件直接转换为 Login.aspx 页面。这样对吗?我该如何解决这个问题?