p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Basics (http://p2p.wrox.com/forumdisplay.php?f=136)
-   -   Login failed for user 'username'. (http://p2p.wrox.com/showthread.php?t=65130)

stupid January 9th, 2008 12:00 AM

Login failed for user 'username'.
Ok, I have done this a million times before, but this time I am running into a SQL authentication problem that I can not diagnose.

I am running SQL 2005, Server 2003 and ASP.NET 2.0 (3.5 is installed as well)

I have both SQL Server and Windows authentication enabled in SQL server mgmt studio. And I have created a login 'username' under the security->logins tab as well - that user has sysadmin server roles. Yet, when I use my application (that works on another server by the way) I get this error:

Login failed for user 'stan'.

 This is my connection string:

<add name="conString" connectionString="Data Source=localhost;Initial Catalog=tablename;User Id=username;Password=password;" providerName="System.Data.SqlClient"/>

Any ideas? Thank you

planoie January 9th, 2008 10:13 AM

It sounds like ASP.NET is trying to connect with your windows credentials instead of a SQL login. Can you change SQL to use only SQL Server logins to verify this what's happening?


stupid January 10th, 2008 02:22 AM

Thanks for the reply, I went in there to triple check that I had this already set and I noticed something strange.

Instead of simply showing

SERVERNAME (SQL Server 9.0.1406...)

like I am used to, it showed


When I had logged on, I had been logging on to the default in the dropdown which was that OFFICESERVERS. I had to choose 'Connect' and show the normal server as well.

I had never had to look for this before, as by default, there will be no OFFICESERVERS. BUT, in this case, on this server, I had already instsalled an instance of Sharepoint... which does. So, I had to recreate all my DBs in the correct Server instance.

Thanks for the help :P I just wasted 3 hours on this...

gbianchi January 10th, 2008 08:08 AM

You never wasted hours.. you learned new ways to do it ;)



================================================== =========
Read this if you want to know how to get a correct reply for your question:
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
================================================== =========
I know that CVS was evil, and now i got the proof:
================================================== =========

dparsons January 10th, 2008 08:23 AM

As Edison said: "I have not failed 10,000 times. I have successfully found 10,000 ways that will not work." =]

================================================== =========
Read this if you want to know how to get a correct reply for your question:
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========

All times are GMT -4. The time now is 05:42 PM.

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