Home All Groups Group Topic Archive Search About

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

Author
20 Mar 2006 1:50 PM
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 ?

Author
20 Mar 2006 1:54 PM
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.

---
http://www.sqlserver2005.de
---
Author
20 Mar 2006 2:37 PM
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" />
Author
20 Mar 2006 2:58 PM
Dominick Baier [DevelopMentor]
as stated in my other response -

you are using integrated authentication - this means that the current worker
process account is used to connect to sql server - which is ASPNET on XP.

This will not work, as you can't grant access to ASPNET on a remote machine.

Either impersonate a windows account that that has access to the the sql
server machine / database
or supply explicit credentials of an sql server account in the connection
string. you may have to change the authentication mode from windows to mixed
in sql server.

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

Show quoteHide quote
> 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" />
Author
20 Mar 2006 1:54 PM
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.

---
http://www.sqlserver2005.de
---
Author
20 Mar 2006 1:55 PM
Uri Dimant
Hi
How do you set up your database? A Windows Authenication or Mixed?

<CLar***@gmail.com> wrote in message
Show quoteHide quote
news:1142862649.046140.21050@z34g2000cwc.googlegroups.com...
> 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 ?
>
Author
20 Mar 2006 3:04 PM
CLarkou
Hi, I set it as "Integrated Security=True"
Author
20 Mar 2006 4:14 PM
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.


---
http://www.sqlserver2005.de
---
Author
21 Mar 2006 8:07 AM
CLarkou
The server authentication is "Windows Authentication Mode".
Author
21 Mar 2006 8:39 AM
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.
Author
21 Mar 2006 8:43 AM
Dominick Baier [DevelopMentor]
you only have to setup delegation if you want to use the clients' credentials
for the sql server login - in this case he just trying to use the process
account - which will not work for the ASPNET account.

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

Show quoteHide quote
> 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.
>
Author
21 Mar 2006 9:02 AM
Chris
Apologies for my questions/answers.The security accounts should be set
on SQL SErver machine or on IIS ?
Author
20 Mar 2006 4:33 PM
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.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

<CLar***@gmail.com> wrote in message
Show quoteHide quote
news:1142867073.546213.317310@t31g2000cwb.googlegroups.com...
> Hi, I set it as "Integrated Security=True"
>
Author
21 Mar 2006 6:28 AM
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 ?
Author
21 Mar 2006 7:13 AM
Dominick Baier [DevelopMentor]
no - the current security identity is used (which is different is file system
projects)

you can output that using:

WindowsIdentity.GetCurrent().Name

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

Show quoteHide quote
> 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 ?
>
Author
21 Mar 2006 2:52 PM
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.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

<CLar***@gmail.com> wrote in message
Show quoteHide quote
news:1142922538.964796.18230@e56g2000cwe.googlegroups.com...
>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 ?
>
Author
21 Mar 2006 3:17 PM
Dominick Baier [DevelopMentor]
he never mentioned he is impersonating in asp.net - so no delegation needed.
Cassini runs with the credentials of the interactive user - which seems to
have access to sql - in contrast to the local ASPNET account - which i am
trying to tell him since 2 days....

yes - use explicit credentials and enable mixed mode auth in sql server to
get this to work.

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

Show quoteHide quote
> 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.
>
> <CLar***@gmail.com> wrote in message
> news:1142922538.964796.18230@e56g2000cwe.googlegroups.com...
>
>> 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 ?
>>
Author
20 Mar 2006 1:56 PM
Dominick Baier [DevelopMentor]
you web application runs under the ASPNET account, which has no meaning on
the sql box -

use the <identity> element or impersonate a fixed account (one that exists
on the sql box) or supply credentials in the sql connection string.

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

Show quoteHide quote
> 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 ?
>
Author
31 Mar 2006 1:22 AM
SimonW
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

Show quoteHide quote
"CLar***@gmail.com" wrote:
> 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 ?
Author
31 Mar 2006 5:21 AM
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.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Show quoteHide quote
"SimonW" <Sim***@discussions.microsoft.com> wrote in message
news:DE86DF27-722A-4665-B1D4-66FBD596461C@microsoft.com...
>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
>
> "CLar***@gmail.com" wrote:
>> 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 ?
>