Allow users to access specific locations in ASP

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

Getting Started

  1. Open your ASP project

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

open webconfig Allow users to access specific locations in ASP

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

edit code Allow users to access specific locations in ASP

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

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 defined access to users.

This concludes Allow users to access specific locations in ASP

Looking for quality Windows Hosting? Look no further than Arvixe Web Hosting!

Happy Hosting

Tags: , , , , , , , , , , | Posted under ASP .NET 4.0 | RSS 2.0

Author Spotlight

Rodolfo Hernandez

I like photography and reading books. Currently working for Arvixe as Elgg Community Liaison. Elgg Security Expert Web Security Expert CEO of UDP SW Social Web

Leave a Reply

Your email address will not be published. Required fields are marked *