Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old February 27th, 2009, 07:25 AM
Registered User
 
Join Date: Feb 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cannot open database "localdb_auth" requested by the login. The login failed.

Hello

I have what one might call a conundrum.

I have a ASP.NET 3.5 web application using Microsoft’s membership API running on a MS SQL 2005 server. I’m trying to get the application to run solely on my local machine.

I have downloaded the app from my source repository and it compiles builds and deploys fine. There are three databases that the application connects two and all three connection strings are defined within the web.config file. If I set the data source name to my development server where the databases are held the application logs in fine without a problem. If I then go about backing up the databases and then restoring them on my laptop (the local machine), then changing the data source to my local machine and I get the following error

error|500| Cannot open database "localdb_auth" requested by the login. The login failed.
Login failed for user 'user'

I’m using SQL authentication and the username ‘user’ has the db_owner Role for all my databases

What is even stranger, is that I tried this on another laptop, did exactly the same tasks in exactly the same order. Without having to edit any of the permissions in the database (i.e. its an exact duplicate to that on the dev server).

This is error is occurring when trying to log into using the ASP.NET Login control using the Forms Authentication.

I’ve have ruled out a problem with the Application as this works fine on a different database, I have ruled out configuration problem in the database them selves as its worked else where.

So I must be a problem with the why my local SQL server is set up, but I can’t figure out what.

Any suggestions would be greatly appreciated.

Oh one last thing, I was able to login to the database (through SQL Management Studio) using the ‘user’ login and password fine.

Thank you for your time!
  #2 (permalink)  
Old February 27th, 2009, 10:55 AM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

It sounds like you didn't set the ApplicationName in your membership provider. When this happens, and you move an application to a different server, you will usually lose the ability to log in users created from the original server.

You need to read the following article:

http://weblogs.asp.net/scottgu/archi...Providers.aspx

Once you understand how the ApplicationName attribute works, you should be able to fix this.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #3 (permalink)  
Old February 27th, 2009, 11:27 AM
Registered User
 
Join Date: Feb 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks very much for your reply,

unfortunately that isn't the problem, and application name has been set and the site is running under the same application as it was previously. and any how this isn't an issue with the way the application is set up as if you simply change the database machine name to my development server it works correctly.

I also don't get a "login failed, please try again message" its a Sys.WebForms.PageRequestManagerServerErrorExceptio n .

THe problem isn't how the application is set up, its having problems actually accessing the database.

When a trace is run on the database no transactions are being recorded. this means its not even getting a chance to queary the database at all.

Its not database not found error either as that error message is different.

Thanks
  #4 (permalink)  
Old February 27th, 2009, 11:38 AM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Wow, that is weird. Just curious, are you using User Instances here?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #5 (permalink)  
Old February 27th, 2009, 11:57 AM
Registered User
 
Join Date: Feb 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

it certainly is mighty weird, i've had for of my developer friends all scratching our heads at what on earth could be causing this problem. I swear the weird ones always happen to me.

I'm going to try starting afresh, which includes re-installing SQL2005.

and to answer your question, no i'm not using User Instances
  #6 (permalink)  
Old March 2nd, 2009, 08:43 AM
Registered User
 
Join Date: Feb 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Even after re-installing SQL server the problem persists. computing is such a love hate relationship!!


Similar Threads
Thread Thread Starter Forum Replies Last Post
Downloaded code: "20-4" missing Rachel BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 1 February 16th, 2009 06:00 PM
how to read xml files doing select="document()" ? eruditionist XSLT 2 February 10th, 2009 05:08 PM
Message received by "FILE" adapter is suspended skindika Biztalk 0 February 2nd, 2009 07:06 PM
WebPart not supporting/enabled displaymode other than "Browse" amitjoshipune ASP.NET 2.0 Professional 1 January 9th, 2009 02:34 PM
google Response.Write(Request.QueryString("q")) senol01 ASP.NET 2.0 Basics 1 January 2nd, 2009 12:01 PM





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