Reputation: 31
How to allow anonymous access in routeconfig in asp.net mvc 5 ?
In routeconfig I've added:
routes.MapRoute(
name:"cert",
url:".well-known/acme-challenge")
I want to allow anonymous access to mydomain.com/.well-known/*
Upvotes: 1
Views: 436
Reputation: 43
I found one solution. I have 2 folders named Monitoring & Resources in web layer and I put this code in my web.config and this will work for me
<location path="Monitoring">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
<location path="Resources">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
Upvotes: 1
Reputation: 29
Just put the tag [AllowAnonymous] on top of the function in your controller you want to allow anonymous access
Upvotes: 0