1

Web アプリに ASP.NET フォーム認証を使用しています。認証されていないユーザーにアクセスを許可したいフォルダーがあります。IIS 7 を使用しており、アプリケーション プールは統合モードになっています。テストとして、ScriptsHandlers フォルダー内に hello.txt を作成しました。IIS を使用して参照しようとすると、場所の要素にもかかわらず、ログイン ページにリダイレクトされます。また、アプリケーションを実行しているときに、フォルダーに保存されている asmx Web サービスを照会すると、401 Unauthorized エラーが発生します。ここに私のweb.configのスニペットがあります:

<location path="ScriptsHandlers">
    <system.web>
      <authorization>
        <allow users="?"/>
      </authorization>
    </system.web>
  </location>
  <location allowOverride="true">
    <system.web>
      <authentication mode="Forms">
        <forms loginUrl="Views/Login.aspx" name=".ASPXFORMSAUTH" cookieless="UseUri" slidingExpiration="true" />
      </authentication>
      <authorization>
        <deny users="?" />
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
4

1 に答える 1

0

ScriptsHandlers フォルダー内のすべてへのアクセスを許可する

ScriptsHandlers Or /ScriptsHandler depending on where you keep this web.config
<location path="ScriptsHandlers">
   <system.web>
    <authorization>
      <allow users="*"/>
    </authorization>
  </system.web>
</location>
于 2013-05-15T19:08:53.697 に答える