In this article, I m going to explain how to Apply Security to Admin Folder in Website by using the default Asp .Net Security in Visual Studio.
There are few steps, you have to follow the below given steps :-
Step 1. Create a Login Form by using the in-built Login Control from the Toolbox. the Login Page looks like as follows :-
Step 2. Now, Right-Click on the Admin Folder that Resides in the Website Root Directory, Shown as below:-
Step 3. Now, Click on the Website tab From the Menu Bar, and Choose ASP.Net Configuration Option from it. It will open a ASP.Net Website Administration Tool Wizard that helps you to apply Security, Create User's, Add Roles, and Access Rules etc.which is shown as:-
Step 4. Now, Click on Security link button shown in the above Page. It will Opens a new Page as :-
Step 5. Now, Click on Select Authentication type Option.
Step 6. After Selecting From the internet Radio Button, and then Click on Done Button.
Step7. Now, Click on Enable Roles option shown in the page as follows:-
Step8. Now, Click on Manage and Create Roles option. It allows you to add a new Role. Add A new Role "Admin_1" :-
The New Role Admin_1 has been Created and is shown as below:-
Now, Click on Back Button.
Step 9. Now, The Next Step is to Create User. To Create New User Click on the Create User Option.
It will Redirect You to the Create new User Page, which is shown as below:-
After Entering the information, Click on the Create user Button. It will Create a new user Successfully, if the information entered by you is right.
Step10. Now, Create Access Rules by clicking on Create Access Rules Option as shown below :-
By Clicking on this option, it will opens a New page, which helps you to create access rules as follows :-
Step11. Now, Set the Access Rules for Website as well as Admin Folder.
Set the Website Rules as follows:-
Set the Admin Folder Rules as follows:-
Step 12. Now,Open the Properties Window of Login Control and Set the Designation Page URL to Admin\Welcome.aspx.
Now, Set the Welcome page to Set As Start Page that resides in the Admin Folder, and Run it.
You will see that the Login Page is Opened, prompting for UserName and Password. if you are Valid user than you can be redirected to the Admin\Welcome.aspx as shown below:-
Otherwise, Login attempt is Wrong Error message is Displayed.













