2011-09-07 197 views
2

我有一個asp.net/silverlight網站,曾經在iis6下工作。我們升級到iis7.5,但我無法正常工作。IIS 7.5和授權

基本上之前,該網站已設置與表單授權和整個網站設置爲拒絕所有用戶。然後,我設置登錄頁面,圖像和default.aspx文件以便進行惡意訪問。都好。

我也有其他文件夾上的角色安全設置。一旦用戶登錄,他們將獲得他們的角色,並且他們能夠訪問他們有權訪問的文件夾。

在7.5中幾乎沒有任何工作。我已經關注了網絡上的所有信息,但無濟於事。誰能幫

這裏是我的web.config文件

<authentication mode="Forms"> 
     <forms loginUrl="login.aspx" requireSSL="false" timeout="30" /> 
    </authentication> 

    <authorization> 
     <deny users="?" /> 
    </authorization> 


<location path="images"> 
    <system.webServer> 
     <security> 
     <authorization> 
        <add accessType="Allow" users="*" /> 
     </authorization> 
     </security> 
    </system.webServer> 
</location> 

<location path="default.aspx"> 
    <system.webServer> 
     <security> 
     <authorization> 
        <add accessType="Allow" users="*" /> 
     </authorization> 
     </security> 
    </system.webServer> 
</location> 

<location path="www"> 
    <system.webServer> 
     <security> 
     <authorization> 
        <add accessType="Allow" users="*" /> 
     </authorization> 
     </security> 
    </system.webServer> 
</location> 

<location path="manuals/customer"> 
    <system.webServer> 
     <security> 
     <authorization> 
      <add accessType="Allow" users="" roles="man_customer" /> 
      <add accessType="Deny" users="*" /> 
     </authorization>   
     </security> 
    </system.webServer> 
</location> 

<location path="manuals/msa"> 
    <system.webServer> 
     <security> 
     <authorization> 
      <add accessType="Allow" users="" roles="man_msa" /> 
      <add accessType="Deny" users="*" /> 
     </authorization>   
     </security> 
    </system.webServer> 
</location> 


<location path="documents/msa"> 
    <system.webServer> 
     <security> 
     <authorization> 
      <add accessType="Allow" users="" roles="doc_msa" /> 
      <add accessType="Deny" users="*" /> 
     </authorization>   
     </security> 
    </system.webServer> 
</location> 

<location path="documents/admin"> 
    <system.webServer> 
     <security> 
     <authorization> 
      <add accessType="Allow" users="" roles="doc_admin" /> 
      <add accessType="Deny" users="*" /> 
     </authorization>   
     </security> 
    </system.webServer> 
</location> 

<location path="documents/customer"> 
    <system.webServer> 
     <security> 
     <authorization> 
      <add accessType="Allow" users="" roles="doc_customer" /> 
      <add accessType="Deny" users="*" /> 
     </authorization>   
     </security> 
    </system.webServer> 
</location> 

<system.webServer> 
    <validation validateIntegratedModeConfiguration="false" /> 
    <modules> 
      <remove name="FormsAuthentication" /> 
      <add name="FormsAuthentication" 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" /> 
      <remove name="RoleManager" /> 
      <add name="RoleManager" type="System.Web.Security.RoleManagerModule" /> 
      <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 

    </modules> 
    <handlers> 
     <remove name="WebServiceHandlerFactory-Integrated" /> 
     <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
    </handlers> 
    <security> 
     <authorization> 
      <remove users="*" roles="" verbs="" /> 
      <add accessType="Allow" users="?" /> 
     </authorization> 
    </security> 
    <defaultDocument> 
     <files> 
      <clear /> 
      <add value="default.aspx" /> 
     </files> 
    </defaultDocument> 
</system.webServer> 

的部分當網站啓動時,它最初重定向到login.aspx的文件。圖像文件夾中的圖像不可訪問。

回答

0

不知道你是如何在IIS 6上工作的,但是我在IIS 7.5上有類似的運行,並且我的web.config看起來有點不同。試試這個:

<system.web> 
    <authentication mode="Forms"> 
    <forms loginUrl="login.aspx" requireSSL="false" timeout="30" /> 
    </authentication> 
    <authorization> 
    <deny users="?"/> 
    </authorization> 
</system.web> 

<location path="images"> 
    <system.web> 
    <authorization> 
     <allow users="*"/> 
    </authorization> 
    </system.web> 
</location> 
+0

很奇怪。我添加了上面的內容並重新開始工作,但角色沒有起作用。我將角色改回了iis 7.5版本,他們開始正常工作。非常非常奇怪 –