web config page access and permission not working with Global asax Routing

Donald Symmons 3,066 Reputation points
2023-03-04T11:45:18.51+00:00

How do I give permission to a web page or web form for all users in web config file when routing is done in the Global asax file?

This is how I grant permission to all users in the web config file for a page named topic.aspx

<location path="topic.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
</location>

In the Global asax file, the routing is done as this

routes.MapPageRoute("topic", "topic/{ArticleId}/{Slug}", "~/topic.aspx");

When I try to access the page, I get redirected to login. I also tried to change the location path in web config file from topic.aspx to topic because of the Routing in Global asax

<location path="topic">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
</location>

But it doesn’t work

Developer technologies | .NET | Other
Developer technologies | ASP.NET | Other
Developer technologies | XAML
{count} votes

Accepted answer
  1. AgaveJoe 30,126 Reputation points
    2023-03-06T01:56:02.4333333+00:00

    You did not share the IIS authentication configuration or the location of topic.aspx. For Web Forms, I create a public folder and allow anonymous users access to the folder rather then a page.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.