Shaitan00 Posted August 6, 2008 Posted August 6, 2008 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, Quote
Administrators PlausiblyDamp Posted August 6, 2008 Administrators Posted August 6, 2008 Make the method protected rather than private and it should be fine. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Shaitan00 Posted August 7, 2008 Author Posted August 7, 2008 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, Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.