public void Login_click(object sender, EventArgs e) { if (FormsAuthentication.Authenticate(txtUserName.Text, txtPassword.Text)) { lblStatus.Text = ("Welcome " + txtUserName.Text); FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, true); } else { lblStatus.Text = "Invalid credential.Please enter valid credentials."; } }
<location path="~/login"> <system.web> <authorization> <allow users="*"/> </authorization> <compilation targetFramework="4.5"/> </system.web> </location> <system.web> <authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl="~/login" > <credentials passwordFormat="Clear"> <user name="kaplanuser" password="kaplan123"/> <user name="user1" password="pass123"/> </credentials> </forms> </authentication> </system.web>
<authentication mode="None" /> and <remove name="FormsAuthentication" />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)