日期:2014-05-17  浏览次数:20359 次

web.config中配置的授权为什么无效呢?
<authentication mode="Forms">
  <forms loginUrl="~/manage/login.aspx"></forms>
  </authentication>
  <authorization>
  <allow users="*"/>
  </authorization>
<location path="~/manage">
  <system.web>
  <authorization>
  <deny users="?"/>
  </authorization>
  </system.web>
  </location>
这样配置后什么manage文件夹的文件还是可以匿名访问?

------解决方案--------------------
根目录的web.config写
<authentication mode="Forms">
<forms name="AdminUser" loginUrl="~/manage/login.aspx" timeout="60"></forms>
</authentication>

manage的目录里再建一个web.config加上
<!--拒绝匿名用户-->
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
<!--允许匿名用户访问manage目录下的CSS文件文件www.eeeey.net-->
<location path ="Css">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>