R
R.A.M.
Hello
Could you help a beginner with login implementation using asp:Login
(.NET 2.0).
I have in Web.config:
<authentication mode="Forms">
<forms name="Demo.NET" loginUrl="Default.aspx" />
</authentication>
<authorization>
<allow users="demo"/>
<deny users="*"/>
</authorization>
In Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="DefaultPage" %>
...
<form id="LoginForm" method="post" action="Menu.aspx"
style="vertical-align: middle;" runat="server">
<asp:Login ID="DemoLogin" runat="server"
DestinationPageUrl="Menu.aspx"
TitleText="Logging in"
UserName="demo" UserNameLabelText="User"
PasswordLabelText="Password"
PasswordRequiredErrorMessage="Password required."
LoginButtonText="Login" LoginButtonType="Button"
RememberMeSet="true" RememberMeText="Remember me."
InstructionText="Enter: demo/demo."
FailureText="Failure. Try again."
OnLoggingIn="OnLoggingIn" />
</form>
...
And in Default.aspx.cs I have:
...
public partial class DefaultPage : System.Web.UI.Page
{
public void OnLoggingIn(object sender,
System.Web.UI.WebControls.LoginCancelEventArgs e)
{
if (DemoLogin.Password != "demo")
e.Cancel = true;
}
}
I don't understand why after enetring demo/demo on Default page I
receive failure message; OnLoggingIn() passes correctly.
How to correct the problem?
Thank you very much.
/RAM/
Could you help a beginner with login implementation using asp:Login
(.NET 2.0).
I have in Web.config:
<authentication mode="Forms">
<forms name="Demo.NET" loginUrl="Default.aspx" />
</authentication>
<authorization>
<allow users="demo"/>
<deny users="*"/>
</authorization>
In Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="DefaultPage" %>
...
<form id="LoginForm" method="post" action="Menu.aspx"
style="vertical-align: middle;" runat="server">
<asp:Login ID="DemoLogin" runat="server"
DestinationPageUrl="Menu.aspx"
TitleText="Logging in"
UserName="demo" UserNameLabelText="User"
PasswordLabelText="Password"
PasswordRequiredErrorMessage="Password required."
LoginButtonText="Login" LoginButtonType="Button"
RememberMeSet="true" RememberMeText="Remember me."
InstructionText="Enter: demo/demo."
FailureText="Failure. Try again."
OnLoggingIn="OnLoggingIn" />
</form>
...
And in Default.aspx.cs I have:
...
public partial class DefaultPage : System.Web.UI.Page
{
public void OnLoggingIn(object sender,
System.Web.UI.WebControls.LoginCancelEventArgs e)
{
if (DemoLogin.Password != "demo")
e.Cancel = true;
}
}
I don't understand why after enetring demo/demo on Default page I
receive failure message; OnLoggingIn() passes correctly.
How to correct the problem?
Thank you very much.
/RAM/