关于窗口验证的一个问题 (技术内幕第11章)
kw816 2004-08-27 05:52:17 有三个文件
Public.aspx.cs
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect ("secret/ProtectedPage.aspx");
}
/////////////
login.aspx.cs
private void Button1_Click(object sender, System.EventArgs e)
{
if(FormsAuthentication.Authenticate(UserName.Text,PassWord.Text))
FormsAuthentication.RedirectFromLoginPage(UserName.Text,false);
else
Output.Text="Invalid login";
}
/////////////////
Secret/protectedPage.aspx.cs
{...........}
Weg.Config 如下
<authentication mode="Forms" >
<forms loginUrl="Login.aspx">
<credentials passwordFormat="Clear">
<user name="Jeff" password="imbatman"/>
<user name="John" password="redrover"/>
</credentials>
</forms>
</authentication>
Secret/Web.Config 如下
<authentication mode="Forms" />
<authorization>
<deny users="?" />
</authorization>
出现问题如下
1. 浏览public.aspx.cs,点button时,不是指向login页面.
出现 Configuration Error
2. 如直接在login.aspx页面登录,如成功,提示找不到default.aspx
如把public.aspx改成default.aspx,点连接时一样出现第一个错误
各位高手请教,为什么会出现这种错误