How to use Forms Authentication and Authorization in ASP.NET?
Forms Authentication and Authorization Anonymous User 3302 20 Sep 2011 How to use Forms Authentication and Authorization in ASP.NET?
In order to acheive your result first you have to write the some code in web.config file:
<system.web>
<authentication mode="Forms">
<forms loginUrl="login.aspx" defaultUrl="Employee.aspx" />
</authentication>
<authorization>
<allow users="aaa"/>
<allow users="bbb"/>
<deny users="*"/>
</authorization>
</system.web>
Then you have to authenticate and authorized the user based on the user available in authorization part:
string strId = Login1.UserName;
string strPass = Login1.Password;
if (strId == "aaa" && strPass == "aaa")
FormsAuthentication.RedirectFromLoginPage(strId, false);
else
Login1.FailureText = "Invalid ID or Password";
Thanks.