We will discuss on how we can allow specific users to access from specific locations.

Some projects require to set permissions to access specific locations within your project.  In this article I will show you in a step-by-step guide how to restrict access to users in ASP.Net

  1. Open your ASP project

2. In the file explorer, open the web.config file of your project and find the <System> tag.


3. Add the <location path = -> tag with the specific file. Then, add the users that will have access to the location specified



<location path=”MonthlyReports.aspx”>
<deny users=”?” />
<allow users=”Reports\user2, Reports\user3, Reports\userChief” />
<deny users=”*” />


4. The code above specifies the users who have access to the specified location. This is important when projects are large and are developed by different users. It is important to establish the type of authentication, in this code that I’ve used is authentication mode to Windows.

5. And that’s it! You are done in defining access to users. 🙂

Leave a Reply