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

C

CLarkou

My machine has Win XP and IIS 5.1.

I installed Visual Studio 2005 without SQL Express 2005. SQL Server
2005 is installed on another machine with Win 2003.

I created a Web Site in .NET VB. I created a connection with my SQL
server database, I can retrieve/ change data in SERVER EXPLORER. When I
try to create a gridview with data fron one table and to run the web
page in Internet Explorer I receive the following error.

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

Can you please help me ?
 
J

Jens

Which connection string are you using to connect to the database, I
guess you are using SQL Server authentication which isn´t setup
properly on your computer.

So switch to mixed authentication, or use a Windows account to connect
to the database-

HTH, Jens Suessmeyer.
 
J

Jens

Which connection string are you using to connect to the database, I
guess you are using SQL Server authentication which isn´t setup
properly on your computer.

So switch to mixed authentication, or use a Windows account to connect
to the database-

HTH, Jens Suessmeyer.
 
C

CLarkou

I am using the following:

<remove name="LocalSqlServer" />
<add name="SubDispConnectionString1" connectionString="Data
Source=CYNICSQL1;Initial Catalog=SubDisp;Integrated Security=True"
providerName="System.Data.SqlClient" />
 
J

Jens

No, this is just the connection string, not themode SQL Server is set
to. The one (COnnectionString) is the client, the authentication mode
(mixed) is the server side.


HTH, Jens Suessmeyer.
 
R

Roger Wolter[MSFT]

The reason people keep asking about authentication modes is that this error
message usually means you are trying to connect with a SQL Server login to a
SQL Server instance that only supports Windows authentication. It sounds
like this is not your issue because you are connecting with Integrated
Security and not supplying a user name or password. The other possible
cause is that the Windows user has no right to authenticate a Windows
connection on the server where SQL Server is running. This can be a "double
hop" error if you are using Windows authentication on the Web site. It
could also be a case that ASPUSER has no rights to connect to the SQL Server
machine.
 
C

CLarkou

I tried creating a website with FILE SYSTEM, not HTTP, and I was able
to open the web page in IE with SQL server data. ASPUSER is used for
connecting to the SQL SERVER machine with FILE SYSTEM web site ?
 
J

Jens

Keep in mind that if the SQL Server is NOT on the same box as the IIS,
you have to setup delegation of the security accounts that this works.
Otherwise the SQL Server can´t check if your User is *really* the
original one.

HTH, Jens Suessmeyer.
 
C

Chris

Apologies for my questions/answers.The security accounts should be set
on SQL SErver machine or on IIS ?
 
R

Roger Wolter[MSFT]

I assume when you used filesystem, you had IE running on the same box as the
web server so there was just a single hop for authentication and thus
delegation was not needed. I also assume filesystem runs with your
credentials - not ASPUSER but I'm not an expert on ASP.Net. Your problem
could be either ASPUSER not having permissions or delegation. The easiest
solution for either one is to setup a SQL Server authenticated login and try
connecting by putting the user name and password in the connection string.
If that works you at least know what the problem is and can try to address
it.
 
G

Guest

I get this problem starting up the App.
It isn't even carrying out the connection the SQL.
I have had a go at tracking the problem, and if I remove the lines below in
my WEB.CONFIG then it starts up OK

<appSettings>
<add key="ConnectionString1"
value="server=myserver;uid=myuserid;pwd=mypassword;database=mydb"/>
</appSettings>

The cause is if you put these lines in the wrong place.
Ensure that <appsettings> is not inside another block.
cheers
Simon
 
R

Roger Wolter[MSFT]

You're supplying a user name and password which makes this a SQL Server user
login. The error you're getting says you are trying to log in with a SQL
login to a SQL Server that only support Windows authentication.
 

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