Issue with ASP .NET Profile Provider in WPF program

Issue with ASP .NET Profile Provider in WPF program

Postby TonyV » Tue 02 Aug 2011 13:18

I've been working the past couple of days to get the Devart ASP .NET profile provider working in my WPF program. For various reasons, this program cannot use a Windows service to access an authentication system. My program needs to use the Profile Provider to retrieve and update all user profile information directly.

I managed to get my code to the point where it generated a custom profile object descended from ProfileBase (had to find out how to use the inherits attribute in the app.config) but now I'm getting another error.

The Devart database is using a varchar to hold the user ID in the aspnet_Users table. The User ID value is actually a UUID ( aka a GUID ), however. When I call the profile object's Save method to write the profile back to the database, the devart code is using a case-sensitive match on the UserId column. The hex digits in the UserID are stored in the UserId column in upper case; however, it tries to join on the UserId column using the same hex value, but all letters in the ID are in lower case. The inner exception of the exception I get reads: "{"insert or update on table \"aspnet_profiles\" violates foreign key constraint \"aspnet_profiles_userid_ref\""}".

How do I fix this? Can I just change the data type of all UserId columns to UUID? I suspect the fix isn't that easy. Do I need to convert all alpha hex characters in the UUIDs to lower case?

All help is appreciated.
TonyV
 
Posts: 74
Joined: Wed 25 May 2011 15:03

Postby Shalex » Thu 04 Aug 2011 14:55

Please try changing the data type of all userid and roleid columns to UUID in %ProgramFiles%\Devart\dotConnect\PostgreSQL\InstallWebTables.sql. This should help. Notify us about the results.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Mixed results

Postby TonyV » Fri 05 Aug 2011 13:35

I changed the data types of the UserId & RoleId columns to UUID as you suggested. I then tried creating a new user by calling the Membership.CreateUser method. That worked on the first call.

However, trying to call Membership.GetUser( "Username" ) for an existing user throws an exception that reads, "Unable to cast object of type 'System.Guid' to 'System.String'". This is a very big problem as it prevents existing users from logging back in. Oddly, I can create new users without issue, but I can't retrieve them after they're created!

I was afraid that this was going to be the issue with the existing provider, as you're undoubtedly calling PgSqlDataReader.GetString() to retrieve the UserId from the tables. The surprise is that you can create new users without a problem.

I'm going to change the columns back into VARCHARs. We'll just have to do a conversion to lower case when inserting user data from an outside source into the membership provider tables. Unless you guys release a new version that uses Guids in the database and in the provider code.

Tony
TonyV
 
Posts: 74
Joined: Wed 25 May 2011 15:03

Postby Shalex » Mon 08 Aug 2011 13:29

We have reproduced the error. We will investigate the issue and notify you about the results as soon as possible.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Thank you

Postby TonyV » Mon 08 Aug 2011 13:34

Thanks for looking into this. I look forward to hearing your findings.

Tony
TonyV
 
Posts: 74
Joined: Wed 25 May 2011 15:03

Postby Shalex » Wed 10 Aug 2011 12:19

The UUID type of 'userid' and 'roleid' columns in database schema of our ASP.NET Provider Model will be supported starting from the next public build of dotConnect for PostgreSQL (in 2-3 weeks). We will post here when the corresponding build is available for download.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Thank you!

Postby TonyV » Wed 10 Aug 2011 15:49

Thank you Shalex!
TonyV
 
Posts: 74
Joined: Wed 25 May 2011 15:03

Postby Shalex » Wed 07 Sep 2011 11:13

New version of dotConnect for PostgreSQL 5.50 is released!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with valid subscription only): http://secure.devart.com/ .
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=21944 .
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Looks good!

Postby TonyV » Wed 21 Sep 2011 21:01

I have downloaded and installed the 6-Sep-2011 version of the dotConnect libraries. Now that my problem with access a version 9.0.4 server with the new DLLs is fixed, I've updated the table designs to use UUIDs for the UserId and RoleId columns in the aspnet_Xxxx tables.

I'm happy to report that all code is working 100%. Thanks!

Tony
TonyV
 
Posts: 74
Joined: Wed 25 May 2011 15:03


Return to dotConnect for PostgreSQL