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

Donald Symmons 2,856 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

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,342 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,242 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
760 questions
{count} votes

Accepted answer
  1. AgaveJoe 26,181 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