Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 15th, 2006, 06:24 AM
Registered User
 
Join Date: May 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?
 
Old May 15th, 2006, 12:06 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
 
Old May 15th, 2006, 01:56 PM
Registered User
 
Join Date: May 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old May 15th, 2006, 02:04 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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?
 
Old May 15th, 2006, 02:07 PM
Registered User
 
Join Date: May 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old May 15th, 2006, 02:19 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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?
 
Old May 15th, 2006, 04:19 PM
Registered User
 
Join Date: May 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old May 16th, 2006, 01:07 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
 
Old August 19th, 2006, 06:21 AM
Registered User
 
Join Date: Apr 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old August 19th, 2006, 06:58 AM
Registered User
 
Join Date: Apr 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Membership Provider Scott663 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 August 1st, 2008 05:16 PM
Custom Membership Provider kulkarnimonica ASP.NET 2.0 Professional 0 June 21st, 2007 03:56 PM
ASP.NET SQL Membership Provider bignermo ASP.NET 2.0 Professional 2 March 20th, 2007 05:41 AM
Simple ASP.NET Membership Provider Login jumpseatnews ASP.NET 2.0 Basics 0 July 16th, 2006 10:53 AM
custom membership provider msrnivas General .NET 1 September 18th, 2005 04:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.