网站有一页面/fld/xxx.aspx,正常的访问路径是要先登陆后,现在我在网站外面任意写个htm文件....<form method=post action="/fld/xxx.aspx">....,我在
网站外面就可以访问这个页面了。请问有什么简单的方法就能屏蔽掉这种类似问题?(不想写代码,也不想用web.config)
网站外面就可以访问这个页面了。请问有什么简单的方法就能屏蔽掉这种类似问题?(不想写代码,也不想用web.config)
{
HttpContext p = HttpContext.Current;
if (p.Session["AUserName"] == null)
{
//p.Response.Write("<div align='center'>未登陆或会话超时,请重新<a target='_self' href='../admin/Default.aspx'>登录</a>。</div>");
p.Response.Redirect("../Error/LoginError.htm");
p.Response.End();
return true;
}
return false;
}
不可能什么都不写就能进行验证
3楼给出了代码,这是web.config配置文件 <authentication mode="Forms">
<forms loginUrl="Login.aspx"></forms>
</authentication>
"Forms" 您为用户提供一个输入凭据的自定义窗体(Web 页),然后在您的应用程序中验证他们的身份。用户凭据标记存储在 Cookie 中。
<authorization>
<deny users="?" />
</authorization>
deny表示禁止,users="?"表示匿名用户
<location path="NewUser.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<customErrors mode="RemoteOnly" defaultRedirect="Error.aspx">
</customErrors>
<allow users="xx,yy" />
....请问 xx,yy是登陆用户吗?如果是,那是不是要存放在.net能认识的表里啊?
{
//p.Response.Write("<div align='center'>未登陆或会话超时,请重新<a target='_self' href='../admin/Default.aspx'>登录</a>。</div>");
p.Response.Redirect("../Error/LoginError.htm");
p.Response.End();
return true;
}