Jump to content
Xtreme .Net Talk

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


Recommended Posts

Posted

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 {...})

 


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

 

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,

Posted

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,

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...