Login failed for user ''. The user is not associated with a trusted SQL Server connection. #4

Arrgh!  I've check and to make sure SQL Server and Windows Authentication option is selected.  The user has Grant access to connect to database engine and Login is enabled...and also has database read/write privs.  I can login using the username/password from Mangement Studio Express, but I can't from my app.  Here is my web.config:

<connectionStrings>
    <add name="CPT_ConnectionString"
         connectionString="Data Source=192.168.1.40\ccsql1;Integrated Security=SSPI;"
         providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <identity impersonate="true"></identity>
  </system.web>

The only thing I can think of is that my app is using a DSN to connect to the database.  Any ideas?

Many thanks,

Mark

0
mah
1/29/2008 7:48:31 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

12 Replies
231 Views

Similar Articles

[PageSpeed] 57

your using integrated security here.  So its looking for your ASP.NET Worker Process Username.  if you have a specific username and password for the SQL Database take out IntegratedSecurity=SSPI and replace it with username=blah;password=blah

hth,

mcm

0
mcmcomasp
1/29/2008 8:49:26 PM

Thanks for the reply mcm.  Am I suppose to pass the username/password from my login.aspx form to web.config?  Sorry, I'm new.  Here's what the connectionString looks like now.

connectionString="Data Source=192.168.1.40\ccsql1;User ID=;Password=;"

There are going to be 5 different accounts so I need to change the user id/password dynamically.  I wasn't sure if this was clear.

0
mah
1/29/2008 8:56:40 PM
One more thing, I'm not using a DSN.  I'm sure you figured that out from the connectionString.  Sorry for the confusion.  Thanks again!
0
mah
1/29/2008 8:58:31 PM

ok first of all i think im confused now.  your connection from your WEBSITE to your SQLSERVER should NOT have ANYTHING to do with user accounts or passwords.  you should have your own SQL Server account that connects to it, and it should be completely separate (and hidden) from your users information.

please provide me more background so i can help your further, i dont know what you are trying to accomplish with this.

mcm

0
mcmcomasp
1/29/2008 8:59:12 PM

Thanks again mcm,

Here's what I'm trying to accomplish:

In SQL Server I create a user called User1 with a SQL Server authentication password of User1pwd.  This user has read/write privs to the database.

I start my application...first thing is the login page.  I enter User1 as the username and User1pwd as the password.  And by doing this I somehow pass these parameters through the web.config file to connect to the database. 

Thank you so much for the help.  And for being patient!! 

Mark

0
mah
1/29/2008 9:21:12 PM

well as i said the connection between you app and the database should be its own private connection.  Your users should have their own membership (stored in a database) that allows them just access to the web site, etc.  your db connection is of no relation to the users. It should be kept private and secure.

hope this helps.

mcm

0
mcmcomasp
1/29/2008 9:24:50 PM

Well the reason I'm having the problem is that I have an audit table in my database and I'm trying to track who's doing the changes.  I don't know how to track who's doing what if I have one connection between the app and the database.  To me the application and database connections go hand in hand because the app is just a interface to my database.  I need to know who's logged in so changes can be tracked accurately.  Does this make sense?

0
mah
1/29/2008 9:37:54 PM

again. the CONNECTION DOES NOT MATTER !

you can easily add the users name to a table in your datbase.  when they log in you can get it from the Membership class and just use it as a parameter in your update to the table(s).

you really have to drop this notion that each user has their own database connection.  All the information you need you can get through your app. again KEEP YOUR DB CONNECTION SEPARATE

think about it.  User X knows he can access the db with his username and password.  Whats stopping him from downloading SQL Management Tools and connecting to your db and just deleting anything in there (or changing it) He completely bypasses your web app.  Thats a security NIGHTMARE!

hth,

mcm

0
mcmcomasp
1/29/2008 9:42:17 PM

mcm,

Please explain why the connection doesn't matter?  I don't understand Membership classes, etc.  I'm not trying to make this complex. 

I'm obviously not near as knowledgable as you on this matter.  Understand that I come from an Oracle background with vintage asp.  I'm used to creating database accounts and managing them with roles.  That's what I've done here.  Each user has read/write access to this database.  That's all.  If they managed to download Management Studio and log in it's my understanding that they wouldn't have access to anything more than what they would have in the application.  But that's beside the point. 

I guess I don't understand the advantages and disadvantages of windows vs. sql server authentication. 

I'll understand if your fed up and don't want to help anymore.  I'm sure it's frustrating for someone like you to know this like I know simple addition and explain it to a newbie, but it is what it is. 

Thanks for your time.  Maybe I'll see the light one day.

Mark

0
mah
1/30/2008 4:33:03 AM
Hi Mah-skeet are you using windows vista, if you are right click on sql server management studio and click on run as administrator, or if its visual studio click follow the same procedure.
0
Pmillio
1/30/2008 7:18:00 AM

mah-skeet

please read this link from beginning to end and if you have any more questions let me know :

http://msdn2.microsoft.com/en-us/library/ms998292.aspx

mcm

0
mcmcomasp
1/30/2008 3:06:25 PM

Thanks mcm

0
mah
1/30/2008 4:23:44 PM
Reply:

Similar Artilces:

[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
Hello All, I'm Getting the following error when calling a dll from my vb.net application. [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. The dll was written in vb6 and accesses a sql db using the following connection string. Public Const GLOBAL_DNS As String = "DSN=TransSrvFinal;UID=sa;PWD=admin;" This DLL works fine when called from other Windows Apps. However I'm now trying to call this dll from with in an asp.net application. I'm using vb.net as the codebehind. I'm a...

2008 IIS7 connection to SQL Server 2000 on Web Server 2000: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
I am setting up a windows 2008 IIS7 web server, and trying to connect to a windows 2000 sql server 2000 database. I have an IIS6 Windows 2000 web server activately connected just fine. I have anonymous and windows authentication enabled. And in my web.config I have identity impersonate="true" My sql server 2000 typically uses the IISUSER anonymous user set up in IIS6 on my original windows 2000 web server. But this new IIS7 is giving me grief. I can't seem to setup the IUSR or IISUSER or anything in it. I can't even use sql server credentials in my connection string altho...

Login failed for user 'Bachelorplace'. The user is not associated with a trusted SQL Server connection. (.Net SqlClient Data Provider)
please tellme how to resolve this error, i m using server studio management tool. and trying to connect using sql server authentication. my pc is over a domain.   Login failed for user 'Bachelorplace'. The user is not associated with a trusted SQL Server connection. (.Net SqlClient Data Provider)  check whether that sql server is allowing sqlauthentication or not.select that server -> right click it-> select  properties  -> in the window, select security -> check what is the server authentication. it should be  sqlserver and windows authentica...

Getting error "Login failed for user ''. The user is not associated with a trusted SQL Server connection" on trying to authenticate a user
Hi, I created aspnetdb on Sql Server 2005 and modified my web.config LocalSqlServer connection string to connect to the Sql Server instead of mdf file on Sql Server. When i click Log In button on my login control i am getting the error "Login failed for user ''. The user is not associated with a trusted SQL Server connection" But when i bind a radio button list or any control to select from aspnet_users or roles table data is displayed fine without any login errors (i am using aspnetdbConnectionString given below for binding data). Why is it happening only when i authenticate but...

Login failed for user ''. The user is not associated with a trusted SQL Server connection.?
Hello, I just got a copy of a website I was supposed to be working on.  I went to the web.config file changed the machine name to my machine's name and when I try to run the program I get the following error.  Could someone give me some advice on how to fix this ?  Thanks! On your production site, the site passes the web user's credentials (your IUSER account) to your sql server.   Make sure that your local site is set up to pass your credentials along to the sql server.  In your web.config, add identity impersonate=true. --JJPlease mark ...

Login failed for user ''. The user is not associated with a trusted SQL Server connection.
Hello everyone, I have a local IIS (WinXP) and a remote SQL Server 2005 DB.  When I try to run login using the aspnetdb, I get the following error: Login failed for user ''. The user is not associated with a trusted SQL Server connection. When I run the form in debug mode from Visual Web Developer 2005 Express it works fine.  In other words when the VWD launches the web page as http://localhost:1234 it works, but when I run the same page from http://localhost I get the error. I know this is permission issues.  I did a search and found info to add the ASPNET user t...

Login failed for user ''. The user is not associated with a trusted SQL Server connection.
I have a windows 2003 server hosting MS SQL  Server 2005. Another windows 2003 server hosting my App, and clients from the local intranet and outside (web). How do I surpass this problem, when it all works fine locally on my development machine? Use Forms authentication! AlCheersAlMy BlogMapStats.NETPlease click on 'Mark as Answer' if this post answered your question! I am using Forms authentication. <connectionStrings> <add name="memSocConnection" connectionString=" Data Source=WSPASQL01; Initial Catalog=mem_soc;Integrated Security=True" providerName="Syste...

Login failed for user ''. The user is not associated with a trusted SQL Server connection
 Hi to all......... In my project I am using windows authentication and if I am running through the IIS getting this error. Suppose if I am directly run the project or use server authentication then I wont get this error.My web.config file is <?xml version="1.0"?><configuration>  <configSections>    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">  ...

Login failed for user ''. The user is not associated with a trusted SQL Server connection. #6
Hi,        I developed an intranet web application using ASP.NET.Everything works fine in dev environment.Right now we want to test in QA. I have used windows authentication.The web.config file has the following connection string: <add     name="DatabaseConnection"  connectionString="Data Source=(QA);Integrated Security=SSPI;Initial Catalog=databaseII;" /> when the application was tested in QA,it displays the windows login. But I am getting        Login failed for user ...

Login failed for user 'testuser'. The user is not associated with a trusted SQL Server connection.
Hi, I have a copy of VS2005 and i have installed the Microsoft SQL Server Developer Edition I am trying to do my first connection using ASP.net (yay for me...) and it has failed...with this error..Login failed for user 'testuser'. The user is not associated with a trusted SQL Server connection.   can someone please point out why? yes i know that the error seems pretty straight forward but how do i fix it? like how do i make the user a trusted server connection? where do i do it? and what are the steps? the user is an administrator and by rights should have all access to everything....

Login failed for user 'test'. The user is not associated with a trusted SQL Server connection.
Hi all, I am new in asp.net. In my web.config file, I wrote the connection strings as below and then I got the above error. I already changed SQL server Authentication mode to "SQL server and Windows". Any idea? Thanks in advance. <connectionStrings> <remove name="LocalSqlServer" /> <add name="LocalSqlServer" connectionString="Data Source=xxx;Initial Catalog=mydb;User ID=test;Password=test;Persist Security Info=False;" providerName="System.Data.SqlClient" /> </connectionStrings>  Hi, If you are using...

Login failed for user ''. The user is not associated with a trusted SQL Server connection. #2
I've seen many, many, many, many posts regarding this topic - but none have been able to fully explain nor fix my problem.I've developed a security solution according to Scott Gu's guide and it works great - but only on my local machine running VWD and SQLExp2005. Once I move this application it completely breaks in the productions environment.  Today I managed to get it halfway there. I created a SQL login and changed my web.config to use these credentials - now the web application will come up, but none of my links (that are role based) are displayed - most likely because ...

Login failed for user ''. The user is not associated with a trusted SQL Server connection. #3
Hi I'm making a website and will upload it next via ftp but i need to access the local server for database retrieval from this website. i'm doing so first time so not sure about its working and isues. Through google search and from forums i collect some info to work on it. now i have made a connection string to access remotely that gives the following error when i make the connection open  "Login failed for user ''. The user is not associated with a trusted SQL Server connection." the local server use the windows authentication mode or may be the mix mode. ...

Login failed for user ''. The user is not associated with a trusted SQL Server connection. #5
hello i am working on a web application where the application and data base are not on the same serverso when trying to connect to the data base from the web application using windows authentication i got that errorLogin failed for user ''. The user is not associated with a trusted SQL Server connection. when i used user id and password the problem solvedcan any one tell me how to make my application run using  windows authenticationone thing else ;this problem raised  after another issuse came from the network that the server is not able to resolve the address or ip of th...

Web resources about - Login failed for user ''. The user is not associated with a trusted SQL Server connection. #4 - asp.net.sql-datasource

Resources last updated: 12/3/2015 4:28:21 PM