Page 1 of 1

Issue with Login Control/ MySqlMembershipProvider.ValidateUser

Posted: Fri 23 Mar 2007 03:23
by lshraybman
:?:
When running ASP.NET app against latest MySQLDirect.NET MySQL 5, I get an exception:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 26:
Line 27: CoreLab.MySql.Web.Providers.MySqlMembershipProvider mp = new CoreLab.MySql.Web.Providers.MySqlMembershipProvider();
Line 28: Authenticated = mp.ValidateUser(userLoginControl.UserName, userLoginControl.Password);
Line 29: //}
Line 30: //catch (Exception ex)


Source File: d:\Projects\RAC\SupportSystem\login.aspx.cs Line: 28

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
CoreLab.Common.Web.Providers.DbMembershipProvider.a(String A_0) +297
CoreLab.Common.Web.Providers.DbMembershipProvider.a(String A_0, String A_1) +100
CoreLab.Common.Web.Providers.DbMembershipProvider.ValidateUser(String username, String password) +55
login.userLoginControl_Authenticate(Object sender, AuthenticateEventArgs e) in d:\Projects\RAC\SupportSystem\login.aspx.cs:28
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +106
System.Web.UI.WebControls.Login.AttemptLogin() +105
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

Posted: Fri 23 Mar 2007 07:48
by Alexey
What is the version of MySQLDirect .NET?
Please send me a small test project to reproduce the problem.
Use e-mail address provided in the Readme file.

Posted: Fri 23 Mar 2007 12:04
by lshraybman
Alexey,

I sent you my project and some extra description to mysqlnet at crlab dot com. Let me know if you need some additional info.

Thank you,
Leo

Posted: Fri 23 Mar 2007 12:44
by Alexey
I've reproduced the problem.
Now we are investigating it.
Look forward to the results.

Posted: Mon 26 Mar 2007 16:15
by Alexey
I think NullReferenceException is a designed behaviour. SQL Server membership provider works the same way. You should initialize your user before calling Validate() method. Take a look at the following code:

Code: Select all

            System.Collections.Specialized.NameValueCollection coll = new System.Collections.Specialized.NameValueCollection(1);
            coll.Add("connectionStringName", "MySqlServices");
            mp.Initialize("AspNetMySqlMembershipProvider", coll);