Unable to login to membership database

C

Crazy Cat

Hi, I'm developing a web application (website option) using VS 2008 /
C#. I used the aspnet_regsql.exe tool to create the membership tables
in the same database that contains my application tables. I was able
to access this using the Web Site Administration web tool to create
users / roles/ etc. Recently we decided to create a new database for
our application, copying the old database to a new one. I can log into
this new database via SQL Server management console and see the aspnet
membership tables. I can also access the application tables within the
application, however the membership functions don't appear to work --
i.e. I can no longer authenticate, and when I attempt to access
membership using the Web Admin Tool I get the following error --

Cannot open database "MyDatabase" requested by the login. The login
failed. Login failed for user 'MyDatabaseUser'.

I've made sure that the connection string is set up in the
web.config's membership section to point to the new database, and as
I've said I can access the tables through SQL Server Management
console. However for some reason they appear inaccessible through the
application. I was even able to use the aspnet_Regsql.exe tool to
remove the old membership tables and recreate them in the new
database, but still I can't appear to authenticate or even access it
via the Web Admin Tool. Note that other application tables are
accessible.

Please help -- this is driving me nuts!

Thanks!!!
 
C

Crazy Cat

Hi, I'm developing a web application (website option) using VS 2008 /
C#. I used the aspnet_regsql.exe tool to create the membership tables
in the same database that contains my application tables. I was able
to access this using the Web Site Administration web tool to create
users / roles/ etc. Recently we decided to create a new database for
our application, copying the old database to a new one. I can log into
this new database via SQL Server management console and see the aspnet
membership tables. I can also access the application tables within the
application, however the membership functions don't appear to work --
i.e. I can no longer authenticate, and when I attempt to access
membership using the Web Admin Tool I get the following error --

 Cannot open database "MyDatabase" requested by the login. The login
failed. Login failed for user 'MyDatabaseUser'.
Stumbled upon the reason for this problem. Apparently the login was
failing because ASPNET was not finding the database because it was
incorrectly defined in the web.config -- the database name was
'SomeDatabase _STG' -- note the there's a space between SomeDatabase
and _STG which required encoded quotes around the name in the
connection string. It was kind of hard to notice (several developers
missed it) and was causing the database to not be found. The
application tables were being found because they were defined in a
LINQ datacontext and the datacontext was providing its own correct
connection string.

Its the little things that can drive you crazy!!!!

Thanks for reading ...
 

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

Top