Managing OnAuthenticate event of asp:login in code-behind [ASP.NET 2005]

Shaitan00

Junior Contributor
Joined
Aug 11, 2003
Messages
358
Location
Hell
I have a page [default.aspx] which associated code-behind [default.aspx.cs].
In my default.aspx page I am using the ASP.NET Login Control and want to be able to manage the authentication event myself by doing the following:
<asp:login id="Login1" OnAuthenticate="OnAuthenticate" runat="server">

In the code-behind [default.aspx.cs] I have added the following function within (public partial class Default_aspx : System.Web.UI.Page {...})

Code:
    private void OnAuthenticate(object sender, AuthenticateEventArgs e)
    {
	string sUser = Login1.UserName;
	string sPwrd = Login1.Password;
	PerformCustomerAuthentication(sUser, sPwrd);
    }

However this approach causes me two problems
a) Error 1 'Default_aspx.OnAuthenticate(object, System.Web.UI.WebControls.AuthenticateEventArgs)' is inaccessible due to its protection level
b) Error 2 The name 'Login1' does not exist in the current context

Is there anyway for me to implement it this way or do I have to add the "OnAuthenticate" function within <script> in the default.aspx page directly?

Any help would be greatly appreciated...
Thanks,
 
That resolves problem (a) but still having the issue with problem (b)
b) Error 2 The name 'Login1' does not exist in the current context

Any clues?
Login1 is the asp:Login control id, not sure why I can't access it.

Thanks,
 
Back
Top