add this on web.config file.
<authentication mode="Forms">
<forms loginUrl="default.aspx">
<credentials passwordFormat="Clear">
<user name="a" password="b" />
<user name="c" password="d" />
</credentials>
</forms>
</authentication>
=======================
<h3>Login</h3>
<asp:Label id="Msg" ForeColor="maroon" runat="server" /><br />
Username: <asp:Textbox id="UsernameTextbox" runat="server" /><br />
Password: <asp:Textbox id="PasswordTextbox" runat="server" TextMode="Password" /><br />
<asp:Button id="LoginButton" Text="Login" OnClick="Login_OnClick" runat="server" />
========================
public void Login_OnClick(object sender, EventArgs args)
{
if (FormsAuthentication.Authenticate(UsernameTextbox.Text, PasswordTextbox.Text))
Msg.Text = "done";
else
Msg.Text = "Login failed. Please check your user name and password and try again.";
}
No comments:
Post a Comment