Membership database problems


Michael Lang

Hi there,

I have a web application that works fine on my local dev machine. However
I'm having less success on my hosting environment.

When I detach the database for this site, copy it to my hosting environment
and attach it through their interface, I can connect to the database in my
hosting environment through the SQL Management studio, see all stored procs,
functions, tables, and the data in the tables I had entered on my local dev
machine. It looks like it should be all good.

However when I attempt to programmatically access members and roles it's
like the data in the tables isn't there

i.e. going through the ASP.NET membership api for example
Membership.GetAllUsers().Count and Roles.GetAllRoles().Length return 0 and
attempting to login under any of the existing accounts fails.

I've checked the SQL User I'm using to connect to the database and it does
have all the aspnet_Membership roles selected. I've checked that it is
connecting to my database (if I change the connection string I get
sqlexception login failure).

Any suggestions?





Kevin Spencer

Did you change the application name in the database when you moved it?


Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:

Michael Lang

I didn't, change it. But I never specified it. Thanks for the clue... it
lead to this post from Scott gu...

As I never specified the applicationName in the config it defaulted to the
vroot path of my dev application which of course is different to the vroot
on my hosting environment.

Solution: I added the applicationName attribute for my membership and
roleprovider and now it's all good.




Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question