user3066249
user3066249

Reputation: 31

Anonymous access in MVC 5

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

Answers (2)

Shivam Kalra
Shivam Kalra

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

Ricardo
Ricardo

Reputation: 29

Just put the tag [AllowAnonymous] on top of the function in your controller you want to allow anonymous access

Upvotes: 0

Related Questions