2012-04-10 42 views
0

这里是我的问题......的Web.config窗体身份验证>保护根,但允许访问子目录

我在II7集成的管道模式下运行的网站,我想从整个网站上启用窗体身份验证分开包含登录表单的'/ secure /'目录。

我的web配置目前看起来是这样的......

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.web> 
     <customErrors mode="Off"/> 
     <authentication mode="Forms"> 
      <forms name=".ASPXAUTH" loginUrl="secure/login.aspx" protection="All" path="/" timeout="999999" slidingExpiration="true" enableCrossAppRedirects="true"> 
       <credentials passwordFormat="Clear"> 
        <user name="user1" password="xxxxxx"/> 
       </credentials> 
      </forms> 
     </authentication> 
     <authorization> 
      <allow users="user1"/> 
      <deny users="*"/> 
     </authorization>  
    </system.web> 
    <location path="secure"> 
     <system.web> 
      <authorization> 
       <allow users="*"/> 
      </authorization> 
     </system.web> 
    </location> 
    <system.webServer> 
     <!--Enabling Forms Authentication for the Entire Application--> 
     <modules> 
      <remove name="FormsAuthenticationModule" />  
      <add name="FormsAuthenticationModule" type="System.Web.Security.FormsAuthenticationModule" />  
      <remove name="UrlAuthorization" />  
      <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />  
      <remove name="DefaultAuthentication" />  
      <add name="DefaultAuthentication" type="System.Web.Security.DefaultAuthenticationModule" />  
     </modules> 
    </system.webServer> 
</configuration> 

当我访问该网站的网址我只是得到重定向的无限循环。我试过把位置特定的认证规则放在system.web部分之上,但是这没有效果。

任何想法?

干杯,

罗宾

回答

3

访问权限是分级的。这就是说,如果你被禁止访问某个父母,那么无论你给孩子设置了什么权限,你都被禁止访问它的所有孩子。 您可以将登录表单移动到根目录并设置表单的权限 - 它将起作用。

相关问题