Bug #74709 Access denied when using connector/net ChangePassword method
Submitted: 6 Nov 2014 10:44 Modified: 24 Dec 2014 5:26
Reporter: Joel Höglund Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.9.3.0 OS:Windows
Assigned to: Assigned Account CPU Architecture:Any
Tags: .net Connector ChangePassword

[6 Nov 2014 10:44] Joel Höglund
Description:
I'm converting over my app from MSSqlServer Membership Provider and I can't get the the ChangePassword method to work. Registering new users, and log in/ log out works without a problem, but when trying to change the password using MySql.Web.Security.MySqlWebSecurity.ChangePassword, it throws an exception:

Access denied for user ''@'fe80::75b3:74e:5698:9a0a%6' (using password: NO)

I'm not sure if I'm just doing something wrong, but as the other methods seem to be working fine, I'm not sure what it could be. I'm connecting to a remote MySql server and my connection string has a username and password which works otherwise. To me it looks like this method tries to connect to the database without using the password and username in the connection string, but if that is the case, I can't understand why.

How to repeat:
I'm using Microsoft Webmatrix and have downloaded the MySql.Web and MySql.Data packages using NuGet. Use InitializeDatabaseConnection to create the database tables and CreateUserAndAccount to create a user. Then try the ChangePassword method to change the password for the user.
[17 Nov 2014 5:24] Chiranjeevi Battula
Hello Joel Höglund,

Thank you for the bug report.
I tried to reproduce the issue at my end using Visual Studio 2013 (C#.Net), MySQL Connector/Net 6.9.3 and EF Version : MySql.Data.Entity.EF6 (6.9.5.0) but not seeing any issues while changing password.
Could you please list out the steps you tried out at your end? Please provide repeatable test case in order for us to confirm this issue at our end.

Thanks,
Chiranjeevi.
[20 Nov 2014 13:19] Joel Höglund
Project files

Attachment: Log.zip (application/zip, text), 14.66 KiB.

[20 Nov 2014 13:32] Joel Höglund
Thanks for your response!

I have uploaded my project files above. I've also tested some things and have noticed a problem in my web.config file. All references to a connectionStringName, for example in MySQLMembershipProvider, points to LocalMySqlServer, while obviously my real connectionstring is the one called "database" in the example below. So my first issue was probably only my own fault. 

<connectionStrings>
        <remove name="LocalMySqlServer" />
        <add name="LocalMySqlServer" connectionString="" providerName="MySql.Data.MySqlClient" />
        <add connectionString="Server=***;Database=***;Uid=***;Pwd=***" name="database" providerName="MySql.Data.MySqlClient" />
</connectionStrings>

The problem is however, when I have tried correcting this, I instead only encounter a new error when trying to access the site at all: "Unable to initialize provider.  Missing or incorrect schema." 

And this line is red-marked:

<add name="MySQLMembershipProvider" writeExceptionsToEventLog="false" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.9.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />

And I can't understand why this error would appear, just by changing the connectionString.
[24 Nov 2014 5:26] Chiranjeevi Battula
Hello Joel Höglund,

Thank you for the bug report.
I tried to reproduce the issue at my end using 
Visual Studio 2013 & .net framework 4.5 (C#.Net), 
MySQL Connector/Net 6.9.3, 6.9.5, 
EF Version : MySql.Data.Entity.EF6 (6.9.5.0).
Couldn't trace out any issue.
Could you please verify connection string in web.config and references. 

Thanks,
Chiranjeevi.
[25 Dec 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".