怀孕抑郁症怎么引起的:ASP.NET的RedirectFromLoginPage方法怎么用?

来源:百度文库 编辑:高考问答 时间:2024/04/29 11:45:03
在根目录的web.config设置如下:

<system.web>
<authentication mode="Forms">
<forms name=".userid" protection="All" timeout="20" />
</authentication>

<authorization>
<deny users="?"/>
</authorization>
</system.web>

为了测试,我建立了一个login.aspx页面,其中只有一个Button控件,其点击事件如下:
protected void Button1_Click(object sender, EventArgs e)
{
System.Web.Security.FormsAuthentication.RedirectFromLoginPage("walkman",false);
}

可是怎么也不能返回Default.aspx页面,按道理讲应该可以的呀!
而且请注意,浏览器中的地址是:http://localhost:3551/wwwroot/login.aspx?ReturnUrl=%2fwwwroot%2fdefault.aspx
回楼下,刚刚要补充,<authentication mode="Forms" loginUrl="Login.aspx"> loginUrl这部分我代码里有写的,只是刚刚发帖时忘了写了,即使是这样都不行的

<authentication mode="Forms">
<forms name=".userid" loginUrl="Login.aspx" protection="All" timeout="20" />