1

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/*

barbsan
  • 3,418
  • 11
  • 21
  • 28
user3066249
  • 31
  • 1
  • 5

2 Answers2

1

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>
Dharman
  • 30,962
  • 25
  • 85
  • 135
0

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

Ricardo
  • 29
  • 5