Adding the Admin Folder and a Page

Adding the Admin Folder and a Page

Here are the steps to add an Admin folder and a page to your ASP.NET web application:

In the Solution Explorer, right-click on your web application project and select “Add” -> “New Folder”. Name the folder “Admin”.

Right-click on the “Admin” folder and select “Add” -> “Web Form”. Name the page “Dashboard.aspx”.

Open the “Dashboard.aspx” page in design view and add some content to it. This could include charts, tables, or other data visualization elements that are relevant to your application’s administration area.

To secure the “Admin” folder and the “Dashboard.aspx” page, add the following code to the web.config file in the “Admin” folder:

<authorization>

  <allow roles=”Admins”/>

  <deny users=”*”/>

</authorization>

This code allows only users who belong to the “Admins” role to access the pages in the “Admin” folder, and denies access to all other users. Test the page by running the application and navigating to the “Dashboard.aspx” page. If you are not currently logged in as an administrator, you should be redirected to the login page.

Apply for ASP.NET Certification Now!!

https://www.vskills.in/certification/certified-aspnet-programmer

Back to Tutorial

Get industry recognized certification – Contact us

Menu