VS2005如果使用Forms驗證,Login頁面不能引用工程中CSS和IMG文件解決方案 [转]

VS2005使用Forms驗證後,如果用戶還未登陸,也就是未通過驗證,就沒有權限使用工程下面的其他文件,如CSS以及圖片等,解決辦法如下:
修改Web.config:
<configuration>
 <appSettings>
 </appSettings>
 <connectionStrings/>
 <system.web>
   <authentication mode="Forms">
   <forms loginUrl="Login.aspx" name=".Performance" timeout="60" path="/">
   </forms>
  </authentication>
  <authorization>
   <deny users="?"/>
   <allow users="*"/>
  </authorization>
 </system.web>
 <location path="CSS/StyleSheet.css">
  <system.web>   
   <authorization>
    <allow users="*"/>
   </authorization>  
  </system.web>
 </location>
 
</configuration>
用<location></location>包含需要有權訪問的目錄或者文件.使用<allow users="*">授權.
posted @ 2007-08-24 09:28  暮江独钓  阅读(364)  评论(0编辑  收藏  举报