求救:访问权限的问题,怎样根据不同的用户,打开不同的页面!!(在线等待)
访问权限的问题,怎样根据不同的用户,打开不同的页面!!
Config怎么配置
比如:学生的ID和密码和数据库相符,登陆学生的页面
老师的ID和密码和数据库相符,登陆老师的页面
给出源代码看看吗
大家帮帮忙,有用立刻结帐
问题点数:50、回复次数:3Top
1 楼saucer(思归)回复于 2003-11-02 22:38:25 得分 50
use forms-based authentication, put the pages in separate directories, modify your web.config, for example
<configuration>
<system.web>
<authentication mode="Forms">
<forms name="MYWEBAPP.ASPXAUTH"
loginUrl="login.aspx"
protection="All"
path="/"/>
</authentication>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
<location path="teachers">
<system.web>
<authorization>
<!-- Order and case are important below -->
<allow roles="Teachers"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<location path="students">
<system.web>
<authorization>
<!-- Order and case are important below -->
<allow roles="Students"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
</configuration>
see details at
Role-based Security with Forms Authentication
http://www.codeproject.com/aspnet/formsroleauth.asp
Top
2 楼terran731(基层干部)回复于 2003-11-02 23:04:11 得分 0
谢谢saucer(思归)
Top
3 楼lxwstar(狂搏无悔)回复于 2003-11-04 16:43:28 得分 0
markTop




