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
- 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"> <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