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ファイルでこれを追加することができます間違い