2017-07-27 2 views
0

ASP.NET WebアプリケーションがWindows Authenticationを使用していて、anonymousユーザーが1つのフォルダ("XYZ"と呼ぶ)を入力できるようにしたいとします。 だから、XYZに、私はIISで作成されたWeb構成を持っている:私は、HTMLページを持っているIIS 10.0 - 1つのアプリケーションフォルダに対してAllowAnonymous(コントローラが機能しません)

XYZインサイド
<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <security> 
      <authentication> 
       <windowsAuthentication enabled="false" /> 
      </authentication> 
     </security> 
    </system.webServer> 
</configuration> 

、とのようなURLを入力:それは尋ねずに開いている

www.site.com/XYZ/htmlPage.html 

権限とすべてが良いです。 しかし、コントローラの操作(コントローラはXYZの中にあります)と同じことをすると、エラーコード401が表示されます。

コントローラー:

[AllowAnonymous] 
public class TestController : Controller 
{ 
    [AllowAnonymous] 
    public ActionResult Index() 
    { 
     return Content("Test content"); 
    } 
} 

ルーティング:

 routes.MapRoute(
      name: "XYZRoute", 
      url: "XYZ/{controller}/{action}/{id}", 
      defaults: new { controller = "Test", action = "Index", id = UrlParameter.Optional }); 

私はあなたが<configuration>セクション内のメインweb.configファイルでこれを追加することができます間違い

答えて

1

を作ってるんだノーアイデア:

<location path="XYZ"> 
    <system.webServer> 
    <security> 
     <authentication> 
      <windowsAuthentication enabled="false" /> 
     </authentication> 
    </security> 
</system.webServer> 
</location> 

そして、あなたはXYZフォルダ内のウェブ設定を削除することができます

関連する問題