p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   asp.net 2 custom membership provider (http://p2p.wrox.com/showthread.php?t=42551)

andyw May 15th, 2006 06:24 AM

asp.net 2 custom membership provider
 
I've been trying for ages to make a custom membership provider work on my hosted web site. I created a SQL 2000 database by scripting the default aspnetdb.mdf to the host site database (which I have no direct access to, nor can I even rename it)

I've added this to my web.config file:

    <membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="aspnetdbConnectionString"
enablePasswordRetrieval="false" enablePasswordReset="true"
requiresQuestionAndAnswer="true" applicationName="/"
requiresUniqueEmail="false" passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
      </providers>
    </membership>

but I now get this error message when trying to log on:

The 'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1'. However, the current database schema is not compatible with this version. You may need to either install a compatible schema with aspnet_regsql.exe (available in the framework installation directory), or upgrade the provider to a newer version.

I'm not really clued up on this, but now I'm completely flummoxed! Can anybody tell me what I@m doing wrong?

Imar May 15th, 2006 12:06 PM

Hi Andyw,

Did you only script the structure of the tables, views, stored procedures etc? Or did you also copy over the data?

The aspnet_SchemaVersions data contains a number of important records. It holds the version number of the present schema in the database for each feature that uses that database. This schema table is used to make future upgrades easier.

Whenever a feature is started up, it checks the schema version table to see if that database has a compatible schema. In your case, this table may be empty, and thus you get the error you see...


HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004

andyw May 15th, 2006 01:56 PM

Hi Imar

Thank you very much indeed for your fast reply. I've checked the aspnet_SchemaVersions table, and you're right - There's no content. What must I enter to get things going?

Regards,

Andy W

Imar May 15th, 2006 02:04 PM

Hi Andy ,

A default installation of an Aspnetdb.mdf database has this:

Feature CompatibleSchemaVersion IsCurrentVersion
common 1 True
health monitoring 1 True
membership 1 True
personalization 1 True
profile 1 True
role manager 1 True

But it's probably easier to look at an existing database of yours and copy the records over.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: And Me by Beastie Boys (Track 11 from the album: Hello Nasty) What's This?

andyw May 15th, 2006 02:07 PM

Hi again, Imar

I just copied all the content of my aspnet_SchemaVersions table, and Bingo!

You're a very VERY good man - I've been struggling with this for weeks.

Many thanks again

Andy W

Imar May 15th, 2006 02:19 PM

You're welcome. You should have come to this place sooner... ;)

Glad it's working. Isn't it nice to discover step by step how the inner workings of ASP.NET 2 operate? Something new to discover every day.....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: Deep by Pearl Jam (Track 10 from the album: Ten) What's This?

andyw May 15th, 2006 04:19 PM

Hi again, Imar

Yes, you're right - I should have checked here before. I got the URL from your excellent Professional ASP.NET 2.0 Security, Membership, and Role Management book, which between it and you have solved weeks of headaches in 24 hours!

More power to you.

Andy W

Imar May 16th, 2006 01:07 AM

Unfortunately, Professional ASP.NET 2.0 Security, Membership, and Role Management is not my book. It's another Wrox book by Stefan Schackow.

I wish it was mine though, as it's easily *the* best book I have seen on the subject....... ;)

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004

Codescribler August 19th, 2006 06:21 AM

I Imar,

I wonder if you could work your magic on the same symptom but a different cause?

The error:
The 'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1'. However, the current database schema is not compatible with this version. You may need to either install a compatible schema with aspnet_regsql.exe (available in the framework installation directory), or upgrade the provider to a newer version.

What I have done:
1. Developed site and DB localy - they work
2. Created empty db via a SQL compare tool from Red Gate on my hosting account
3. Ran the aspnet_regsql.exe against my live db. - It worked
4. Ran my site localy but with a changed web.config to point to the new DB
5. Came up with the above error.
6. Read this forum post and checked the table which was fine and had all the data in it you said to check.

Not sure what to do now,

Any ideas?

Danny


Danny

Codescribler August 19th, 2006 06:58 AM

Problem solved!

Once I uploaded the site and ran it from the server, it was fine. It obviously didnt like being run from my machine with a remote DB!

Thanks anyway - just in case you were planning on replying! :)

Danny


All times are GMT -4. The time now is 09:40 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.