2013-03-12 59 views
1

我試圖構建基於ASP.net的網站。我首先做了主要功能,我需要使網站安全。所以我喜歡設置在web.config:添加授權後,無法在Web應用程序表單中查看圖像

<system.web> 
     <authorization> 
      <deny users="?" /> 
     </authorization> 
     <authentication mode="Forms"> 
      <forms loginUrl="~/Register/Login.aspx" timeout="2800"/> 
     </authentication> 

     <compilation debug="true" targetFramework="4.0" /> 
</system.web> 

當我刪除這些代碼,我可以添加任何圖像或任何元素,他們將表演。但如果我添加這些代碼,圖像將不會顯示。有沒有人有任何想法?

回答

0

在你的web.config,後</system.web>添加如下代碼:

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

,並重復所有其他必要的數據,如CSS,JavaScript等

+0

是不是意味着一旦我改變這個配置,我可以添加任何我想要的,畢竟,我可以改回來? – user2149178 2013-03-12 21:32:13

相關問題