在Web.config中配置<authentication mode="Forms">
<forms name="" loginUrl="" protection="" timeout="" />
</authentication><system.web/>
<location path="XX1.aspx">
<system.web>
<authorization>
<deny users="" />
</authorization>
</system.web>
</location>
<location path="XX2.aspx">
<system.web>
<authorization>
<deny users="" />
</authorization>
</system.web>
</location>
...
</system.web>在判断页面中调用
using System.Web.Security;
用FormsAuthentication来完成安全配置
<forms name="" loginUrl="" protection="" timeout="" />
</authentication><system.web/>
<location path="XX1.aspx">
<system.web>
<authorization>
<deny users="" />
</authorization>
</system.web>
</location>
<location path="XX2.aspx">
<system.web>
<authorization>
<deny users="" />
</authorization>
</system.web>
</location>
...
</system.web>在判断页面中调用
using System.Web.Security;
用FormsAuthentication来完成安全配置
我也看了教程,觉得不懂^_^
有没有简单一点的?
或者通用一点的
form验证的
把代码写在cs文件里,这样比较方便调用。
例:Tools.func1();
2,有没有更好的权限判断方式我们的做法是:在登陆时判断,验证user,存入Session中,可以让所有页面继承一个页面,在父页面中,
根据Session值,作出判断。
我觉得权限判断可以用一个CLASS来做
每个页面都可以调用方法!
session只能验证这个人登录了没有,而不能仔细区分资源权限!
比如说不能断定当前的页面调用来自哪最初的安全页面,
ASPX中身份验证会强调,
当前页面由哪个初始的验证发出,
同一PC下面,可以是多个用户在访问该页,
一方面系统本身设计上会有问题,
另一方面Session的简单验证可以很容易被冒用。
用Authentication来实现,
如果你需要对脚色进行控制授权的话,
还可以Global.asax里面的Application_AuthenticateRequest事件处理里面写入相应的代码,具体可以参照一下MSDN文章:
http://msdn.microsoft.com/msdnmag/issues/02/05/ASPSec2/default.aspx