R
R.A.M.
I have a problem with logging in implementation in ASP.NET 2.0.
I decided to use asp:Login control (which is enough), but I cannot
find solution for handling logging in.
I have an .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="Logowanie"
UserName="demo" UserNameLabelText="U¿ytkownik"
PasswordLabelText="Has³o"
PasswordRequiredErrorMessage="Wymagane has³o."
LoginButtonText="Zaloguj" LoginButtonType="Button"
RememberMeSet="true" RememberMeText="Zapamiêtaj"
InstructionText="Wprowad¼: demo/demo."
OnLoggingIn="OnLogginIn"
VisibleWhenLoggedIn="false" />
</form>
....
in behind-code I wrote:
....
public partial class DefaultPage : System.Web.UI.Page
{
public void OnLoggingIn(object sender,
System.Web.UI.WebControls.LoginCancelEventArgs e)
{
if (DemoLogin.UserName == "demo" &&
DemoLogin.Password == "demo")
DemoLogin.InstructionText = String.Empty;
else
{
DemoLogin.InstructionText = "Failure. Enter: demo/demo.";
e.Cancel = true;
}
}
}
But when trying to build the application I receive error:
ASP.default.aspx does not contain a definition for 'OnLogginIn"
I do not understand this message.
I tried to move OnLogginIn function to .aspx:
<script runat="server">...</script>
but I cannot build, either.
Could you help me please?
Thank you!!!
/RAM/
I decided to use asp:Login control (which is enough), but I cannot
find solution for handling logging in.
I have an .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="Logowanie"
UserName="demo" UserNameLabelText="U¿ytkownik"
PasswordLabelText="Has³o"
PasswordRequiredErrorMessage="Wymagane has³o."
LoginButtonText="Zaloguj" LoginButtonType="Button"
RememberMeSet="true" RememberMeText="Zapamiêtaj"
InstructionText="Wprowad¼: demo/demo."
OnLoggingIn="OnLogginIn"
VisibleWhenLoggedIn="false" />
</form>
....
in behind-code I wrote:
....
public partial class DefaultPage : System.Web.UI.Page
{
public void OnLoggingIn(object sender,
System.Web.UI.WebControls.LoginCancelEventArgs e)
{
if (DemoLogin.UserName == "demo" &&
DemoLogin.Password == "demo")
DemoLogin.InstructionText = String.Empty;
else
{
DemoLogin.InstructionText = "Failure. Enter: demo/demo.";
e.Cancel = true;
}
}
}
But when trying to build the application I receive error:
ASP.default.aspx does not contain a definition for 'OnLogginIn"
I do not understand this message.
I tried to move OnLogginIn function to .aspx:
<script runat="server">...</script>
but I cannot build, either.
Could you help me please?
Thank you!!!
/RAM/