2012-04-10 109 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

訪問權限是分級的。這就是說,如果你被禁止訪問某個父母,那麼無論你給孩子設置了什麼權限,你都被禁止訪問它的所有孩子。 您可以將登錄表單移動到根目錄並設置表單的權限 - 它將起作用。

相關問題