Membership not login me in

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
matt_lethargic
Posts: 2
Joined: Wed 31 Mar 2010 13:14

Membership not login me in

Post by matt_lethargic » Wed 31 Mar 2010 13:22

dotConnect for MySQL 5.70 Beta
Visual Studio 2010 RC
ASP.NET 4

Hi,

I'm trying to get membership working with the above configuration ready for the start of our next project (officially kicking off when VS2010 and dotConnect MySQL 5.70 final are released), but am having minor problems.

I've got membership and roles working, I can add users/roles etc in the ASP.NET Configuration, but when I then try logging in using either the login control or Membership.ValidateUser() it always fails.

My config:

Code: Select all


      
        
        
      
    


      
        
        
      
    


      
    
Any ideas anyone?

Shalex
Site Admin
Posts: 8240
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 02 Apr 2010 11:42

I have checked the 5.70.102 and 5.70.120 versions of dotConnect for MySQL, and the Membership.ValidateUser() method returns true in this case (my web.config is the same as yours):

Code: Select all

        MembershipCreateStatus status;
        Membership.CreateUser("user", "pass!word", "a@a.a", "why?", "because", true, out status);
        // status=Success
        bool isValid = Membership.ValidateUser("user", "pass!word");
        // isValid=true
Make sure that your user exists in your database (status=Success). If the problem persists, please send us a small test project to reproduce the issue in our environment.

matt_lethargic
Posts: 2
Joined: Wed 31 Mar 2010 13:14

Post by matt_lethargic » Tue 06 Apr 2010 09:10

Thanks for the reply

Have just tried the code you gave, status is Successful, but isValid is false. Have creating tried with a few different users and varified that they have entries in the db

Could it be that my schema is wrong in my db??
I can't remember how I created it, is there a script to build this again?

My membership schema:

Code: Select all

CREATE TABLE  `data`.`aspnet_users` (
  `userid` varchar(40) NOT NULL,
  `applicationname` varchar(255) NOT NULL,
  `username` varchar(245) DEFAULT NULL,
  `lastactivitydate` datetime DEFAULT NULL,
  `isanonymous` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`userid`),
  UNIQUE KEY `aspnet_users_username_pk` (`username`,`applicationname`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


CREATE TABLE  `data`.`aspnet_membership` (
  `userid` varchar(40) NOT NULL,
  `password` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `passwordquestion` varchar(255) DEFAULT NULL,
  `passwordanswer` varchar(255) DEFAULT NULL,
  `comments` varchar(255) DEFAULT NULL,
  `isapproved` tinyint(4) DEFAULT NULL,
  `islockedout` tinyint(4) DEFAULT NULL,
  `creationdate` datetime DEFAULT NULL,
  `lastlogindate` datetime DEFAULT NULL,
  `lastpasswordchangeddate` datetime DEFAULT NULL,
  `lastlockoutdate` datetime DEFAULT NULL,
  `failedpasswordattemptcount` int(11) DEFAULT NULL,
  `failedpasswordattemptstart` datetime DEFAULT NULL,
  `failedpasswordanswercount` int(11) DEFAULT NULL,
  `failedpasswordanswerstart` datetime DEFAULT NULL,
  PRIMARY KEY (`userid`),
  CONSTRAINT `aspnet_membership_userid_ref` FOREIGN KEY (`userid`) REFERENCES `aspnet_users` (`userid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Shalex
Site Admin
Posts: 8240
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 07 Apr 2010 13:00

It seems like that the problem persists only with .NET Framework 4.0. We will investigate the issue and notify you about the results as soon as possible.

fastc
Posts: 6
Joined: Thu 08 Apr 2010 17:44

Post by fastc » Sun 11 Apr 2010 14:27

I think I have the same problem.

After upgrading my project to Visual Studio 2010 RC and .NET 4.0 I can't login.
Upgrading to dotConnect 5.70.120.0 did not resolve this.

ASP.NET configuration pages do work.

Any news on this issue?

Shalex
Site Admin
Posts: 8240
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 12 Apr 2010 10:22

We are investigating the issue. I will post here about the results.

Shalex
Site Admin
Posts: 8240
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 23 Apr 2010 08:37

It seems like the problem persists only with .NET 4.0 RC. The final version of .NET 4.0 is without this problem. Could you please confirm that .NET 4.0 RTM is working properly?

markatosi
Posts: 5
Joined: Fri 23 Apr 2010 13:50

Same issue with postgresql

Post by markatosi » Fri 23 Apr 2010 14:05

At any rate the isValid returning false in my case only occurs when the passwordformat is set to "Hashed" it works fine when set to "Clear" or "Encrypted"

I am using the official release version of .net 4.0 and vs studio 2010. I never had any RC or betas installed of VS 2010/Net 4.0

hamsterlegs
Posts: 13
Joined: Wed 09 Jul 2008 16:01

Post by hamsterlegs » Sat 24 Apr 2010 20:35

I have the same problem with

Microsoft Visual Studio 2010
Version 10.030319.1 RTMReI
and NET 4

ASP.NET configuration pages display, two of my three providers are listed but clicking test reports:

Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.

hamsterlegs
Posts: 13
Joined: Wed 09 Jul 2008 16:01

Steps to reproduce

Post by hamsterlegs » Sun 25 Apr 2010 17:52

In Visual Studio 2010 RTM (Version 10.030319.1 RTMReI) on Windows 7 Ultimate 64

1. File | New Project | ASP.NET Web Application

2. Add references to:
Devart.Data (5.0.85.0)
Devart.Data.MySql (5.70.124.0)
Devart.Data.MySql.Web (5.70.124.0)

3. Convert these References to Copy Local = True

4. Setup Connection string in Web.config, e.g.







*** Note this is a new clean empty database which has been setup using the Devart\MyDirect.NET2\InstallWebTables.sql

5. Setup providers, remove other providers and setup Membership Provider:













6. Run project, click Login then Register to create a new user. This new user is added OK and can be seen to be added to the MySql database.

7. Click Login and attempt to login. Always fails.

Note, if the passwordFormat is set to "Clear" this problem does not occur, but if the passwordFormat is set to "Encrypted" then new users cannot be created.

I hope we can get a solution to this soon!

Shalex
Site Admin
Posts: 8240
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 27 Apr 2010 12:11

We have reproduced the problem with the "Hashed" passwordFormat setting and .NET Framework 4.0 RTM. I will post here when it is fixed.

bbjosh
Posts: 6
Joined: Fri 07 Nov 2008 19:38

Post by bbjosh » Tue 27 Apr 2010 20:01

I seem to be having a similar problem. After upgrading to the latest release of dotConnect for Oracle (5.60.124.0) + VS 2010 Ultimate, I cannot use the web membership provider.


If I create a web application and put "int i = Membership.Providers.Count;" it throws an exception "Unknown connection string parameter ."


Filename: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
Source: Devart.Data.Oracle

StackTrace:

at Devart.Common.j.a(Hashtable A_0)
at Devart.Common.j..ctor(String A_0, Hashtable A_1, Boolean A_2)
at Devart.Data.Oracle.u..ctor(String A_0)
at Devart.Data.Oracle.b1.a(String A_0, j A_1)
at Devart.Common.DbConnectionFactory.a(String A_0, j& A_1)
at Devart.Common.DbConnectionBase.set_ConnectionString(String value)
at Devart.Common.Web.Providers.DbMembershipProvider.a()
at Devart.Common.Web.Providers.DbMembershipProvider.Initialize(String name, NameValueCollection config)
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)


I can work around the issue by adding this to the connection strings section of the web.config:



fastc
Posts: 6
Joined: Thu 08 Apr 2010 17:44

Post by fastc » Wed 28 Apr 2010 17:01

Yes. my passwordForma is also net to Hashed.
I'am using .NET 4 4.0.30319 and Visual Studio 2010 Ultimate 10.0.30319.1 RTMRel. I had the RC installed.

Shalex
Site Admin
Posts: 8240
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 29 Apr 2010 14:08

The reason of the problem is that hash algorithm (Membership.HashAlgorithmType) in .NET Framework 4.0 was changed to HMACSHA256 (it was SHA1). We will fix this problem by setting hash algorithm to SHA1 explicitly in our code. The fix will be included to the next build of dotConnect for MySQL. I will post here when it is available for download.

fastc
Posts: 6
Joined: Thu 08 Apr 2010 17:44

Post by fastc » Fri 30 Apr 2010 21:12

Is there a workaround in the meantime?

I tried setting the hashAlgorithmType in my web.config but it does not work:


...

Post Reply