日期:2014-05-16  浏览次数:21837 次

关于Web.Config 限制匿名读取
好奇怪!!试不出来~ 原来用IIS6可以换了IIS7之后竟然失效!

我原来里面有一个目录<DOCTXT>是必须透过 Login.aspx 之后才可以连结里面的文挡,
就算直接打URL+<DOCTXT> 也会转跳到到登入页面,但换了IIS7后竟然直接打URL也能读到文挡??
试了好久不知道哪里有问题请高手们指点迷津!!谢谢~

Web.Config的内容


<?xml version="1.0" encoding="UTF-8"?>

<configuration> 
  <system.web>
    <customErrors mode="Off" />
<compilation debug="true" />
    <authentication mode="Forms">
      <forms loginUrl="Login.aspx" name="UName" defaultUrl="Default.aspx" />   
    </authentication>

    <authorization>   
      <deny users="?" />
      <allow users="*" />
    </authorization>
        <identity impersonate="true" />
</system.web>
  <location path="ImageCaptcha.aspx" allowOverride="true" inheritInChildApplications="true">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
</configuration>

------解决方案--------------------
如果是正常配置的网站,web.config 以及许多文件是不能够直接访问的。