top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

how to allow Different user to access website and deny all other users in ASP.NET?

+2 votes
307 views
how to allow Different user to access website and deny all other users in ASP.NET?
posted Dec 23, 2014 by Sathyasree

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

In this situation we need to write the code in web.config file like this

<configuration>
<system.web>
<authorization>
<allow users="Shivaranjini"/>  <!-- It will allow only Shivaranjini-->
<deny users="*"/>  <!--Deny others -->
</authorization>
</system.web>
</configuration>

If we observe above code it will allow only user “sathya” and deny all other users to access that application. If we want to give permission for more users just add usernames separated with comma like “Radhika,Swathi,Aishwarya,etc”

answer Dec 26, 2014 by Shivaranjini
Similar Questions
+1 vote

This example shows you how to check given input contains only numbers (digits) or not using regular expression in asp.net and c#.

Regular expression
string strRegexpNumber = @"^[0-9 ]*$";

...