Meine ASP.NET-Webanwendung verwendet eine Windows Authentication
und ich möchte nur anonymous
Benutzer in der Lage sein, einen Ordner eingeben (nennen wir es "XYZ"
). So in der XYZ
habe ich eine Web-Config vom IIS erstellt:IIS 10.0 - AllowAnonymous für einen Anwendungsordner (Controller funktioniert nicht)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
</configuration>
Im Inneren des XYZ
ich eine HTML-Seite, und Eingabe der URL wie:
www.site.com/XYZ/htmlPage.html
Es öffnet, ohne zu fragen über Berechtigungen und alles ist gut. Aber wenn ich das gleiche mit meiner Controller-Aktion (Controller ist innerhalb der XYZ
von couse), bekomme ich die 401
Fehlercode.
Controller:
[AllowAnonymous]
public class TestController : Controller
{
[AllowAnonymous]
public ActionResult Index()
{
return Content("Test content");
}
}
Routing:
routes.MapRoute(
name: "XYZRoute",
url: "XYZ/{controller}/{action}/{id}",
defaults: new { controller = "Test", action = "Index", id = UrlParameter.Optional });
Keine Ahnung, wo ich einen Fehler zu machen