Issue with Login Control/ MySqlMembershipProvider.ValidateUser

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
lshraybman
Posts: 2
Joined: Wed 21 Mar 2007 14:48
Location: Maryland, USA

Issue with Login Control/ MySqlMembershipProvider.ValidateUser

Post by lshraybman » Fri 23 Mar 2007 03:23

:?:
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

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Fri 23 Mar 2007 07:48

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.

lshraybman
Posts: 2
Joined: Wed 21 Mar 2007 14:48
Location: Maryland, USA

Post by lshraybman » Fri 23 Mar 2007 12:04

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

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Fri 23 Mar 2007 12:44

I've reproduced the problem.
Now we are investigating it.
Look forward to the results.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 26 Mar 2007 16:15

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);

Post Reply