您的位置:首页 > 编程语言 > ASP

ASP.NET Forms验证实现只有特定目录才要求登录

2012-07-01 09:28 477 查看
一、把Web根目录下的web.config中allow users的属性值设为“*”,意思是允许任意用户访问根目录下的所有页面。

<authentication mode="Forms">
    <forms loginUrl="Console/Default.aspx" name=".ASPXFORMSAUTH" defaultUrl="Console/Welcome.aspx">
    </forms>
</authentication>
<authorization>
    <allow users="*"/>
</authorization>

二、在admin下再建个web.config,这个文件的作用域只是Console目录下的所有页面

admin\Web.config文件全部代码:

<?xml version="1.0"?>
<configuration>
    <system.web>
        <authorization>
            <deny users="?"/>
        </authorization>
    </system.web>
</configuration>

 

物流配货网http://wlphw.com/ QQ在线:471226865

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: