1

Connecting through Sql Server's Management Studio works, however, it will not connect through the web.config connection string.

<add name="cnString" connectionString="Data Source=(local); Initial Catalog=MyDB; User ID=andrewbb; Password=myPassword;" providerName="System.Data.SqlClient" />

It returns: Login failed for user 'andrewbb'. Reason: Password did not match that for the login provided. [CLIENT: ]

Both the password and user id are lowercase. Ideas?

pbaris
  • 4,525
  • 5
  • 37
  • 61
Andrew
  • 326
  • 1
  • 7
  • Is it a windows ID or a SQL ID? If its an sql ID You may need to add "Integrated Security=false" – BugFinder Sep 19 '12 at 06:49
  • did you set the password and user name respectively of the MyDB database in the Sql Server's Management Studio? –  Sep 19 '12 at 06:49
  • are you in a domain? Is your SQL Server set to Windows Authentication mode only? (This can be checked in the Sever-Properties -> Security) – konqi Sep 19 '12 at 06:49

2 Answers2

1

Your log-in details need to keep all the time. Include following in connection string to keep security info.

Persist Security = true

Refer : Difference Between Persist Security Info And Integrated Security?

Community
  • 1
  • 1
Prasanna
  • 4,583
  • 2
  • 22
  • 29
0

Try adding NETWORK SERVICE account to the database

How to: Use the Network Service Account to Access Resources in ASP.NET

Check This

Kapil Khandelwal
  • 15,958
  • 2
  • 45
  • 52