HighTechTalks DotNet Forums  

Trusted SQL Server connection

Dotnet Framework (ODBC.net) microsoft.public.dotnet.framework.odbcnet


Discuss Trusted SQL Server connection in the Dotnet Framework (ODBC.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Ray Valenti
 
Posts: n/a

Default Trusted SQL Server connection - 11-17-2003 , 01:19 PM






I am able to preview this data in the development environment, but when I
run the application the error below shows up.
How do I set up a Trusted Connection?

-Ray

Server Error in '/WebApplication2' Application.
----------------------------------------------------------------------------
----

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'(null)'. Reason: Not associated with a trusted SQL Server connection.






Reply With Quote
  #2  
Old   
Chris Bower
 
Posts: n/a

Default Re: Trusted SQL Server connection - 11-17-2003 , 01:28 PM






In your connection string are you providing a user name?
To set up a Trusted Connection the web server would have to be a member of
the domain the SQL server is in (or at least a trusted domain) and you would
need to set up an account for whatever user you have the ASPNET_wp process
running under.

You may be able to browse in preview mode because of your domain account
having an account on the sql server?

"Ray Valenti" <RValenti (AT) neo (DOT) rr.com> wrote

Quote:
I am able to preview this data in the development environment, but when I
run the application the error below shows up.
How do I set up a Trusted Connection?

-Ray

Server Error in '/WebApplication2' Application.
--------------------------------------------------------------------------
--
----

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for
user
'(null)'. Reason: Not associated with a trusted SQL Server connection.








Reply With Quote
  #3  
Old   
Steve C. Orr [MVP, MCSD]
 
Posts: n/a

Default Re: Trusted SQL Server connection - 11-17-2003 , 02:14 PM



At design time you're running under your user account, which SQL Server
apparently trusts.
However at runtime (by default) ASP.NET runs under a user account named
ASPNET.
Make sure this user is also established in your SQL Server database as a
trusted user.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com




"Ray Valenti" <RValenti (AT) neo (DOT) rr.com> wrote

Quote:
I am able to preview this data in the development environment, but when I
run the application the error below shows up.
How do I set up a Trusted Connection?

-Ray

Server Error in '/WebApplication2' Application.
--------------------------------------------------------------------------
--
----

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for
user
'(null)'. Reason: Not associated with a trusted SQL Server connection.








Reply With Quote
  #4  
Old   
Ray Valenti
 
Posts: n/a

Default Re: Trusted SQL Server connection - 11-17-2003 , 02:22 PM



Chris,

The connection string is:

strConnect = @"data source=MYSERVER;initial catalog=MainDb;integrated
security=SSPI;persist security info=True;workstation id=MYWORKSTAT;packet
size=4096";

I tried a different version with a user id and password and get the same
message about not being a trusted connection.

Login failed for user 'Ray'. Reason: Not associated with a trusted SQL
Server connection.

With ADO I would use a DSN the string would be just "DSN=MyDSN"

The Ray user does have an account on the server.

--
"Chris Bower" <chris.bowerNO (AT) SPAMunionfedbank (DOT) com> wrote

Quote:
In your connection string are you providing a user name?
To set up a Trusted Connection the web server would have to be a member of
the domain the SQL server is in (or at least a trusted domain) and you
would
need to set up an account for whatever user you have the ASPNET_wp process
running under.

You may be able to browse in preview mode because of your domain account
having an account on the sql server?

"Ray Valenti" <RValenti (AT) neo (DOT) rr.com> wrote in message
news:8j8ub.15124$up3.8285 (AT) fe1 (DOT) columbus.rr.com...
I am able to preview this data in the development environment, but when
I
run the application the error below shows up.
How do I set up a Trusted Connection?

-Ray

Server Error in '/WebApplication2' Application.

--------------------------------------------------------------------------
--
----

Login failed for user '(null)'. Reason: Not associated with a trusted
SQL
Server connection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for
user
'(null)'. Reason: Not associated with a trusted SQL Server connection.










Reply With Quote
  #5  
Old   
Chris Bower
 
Posts: n/a

Default Re: Trusted SQL Server connection - 11-17-2003 , 02:33 PM



integrated security=SSPI

Thats the culprit right there. I believe removing that section of your
connection string and then adding the user id and password back in should
work. However, if you want to use Integrated Security you can just give your
ASPNET account a SQL account. If the sql server is on the same machine its
easy to do, if not, you'll need to change what process the aspnet_wp runs
under to a domain account and then grant the domain account access to your
sql db.

"Ray Valenti" <RValenti (AT) neo (DOT) rr.com> wrote

Quote:
Chris,

The connection string is:

strConnect = @"data source=MYSERVER;initial catalog=MainDb;integrated
security=SSPI;persist security info=True;workstation id=MYWORKSTAT;packet
size=4096";

I tried a different version with a user id and password and get the same
message about not being a trusted connection.

Login failed for user 'Ray'. Reason: Not associated with a trusted SQL
Server connection.

With ADO I would use a DSN the string would be just "DSN=MyDSN"

The Ray user does have an account on the server.

--
"Chris Bower" <chris.bowerNO (AT) SPAMunionfedbank (DOT) com> wrote in message
news:%23DrtOiTrDHA.964 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
In your connection string are you providing a user name?
To set up a Trusted Connection the web server would have to be a member
of
the domain the SQL server is in (or at least a trusted domain) and you
would
need to set up an account for whatever user you have the ASPNET_wp
process
running under.

You may be able to browse in preview mode because of your domain account
having an account on the sql server?

"Ray Valenti" <RValenti (AT) neo (DOT) rr.com> wrote in message
news:8j8ub.15124$up3.8285 (AT) fe1 (DOT) columbus.rr.com...
I am able to preview this data in the development environment, but
when
I
run the application the error below shows up.
How do I set up a Trusted Connection?

-Ray

Server Error in '/WebApplication2' Application.


--------------------------------------------------------------------------
--
----

Login failed for user '(null)'. Reason: Not associated with a trusted
SQL
Server connection.
Description: An unhandled exception occurred during the execution of
the
current web request. Please review the stack trace for more
information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed
for
user
'(null)'. Reason: Not associated with a trusted SQL Server connection.












Reply With Quote
  #6  
Old   
Cowboy \(Gregory A. Beamer\)
 
Posts: n/a

Default Re: Trusted SQL Server connection - 11-17-2003 , 03:10 PM



There are a couple of ways to do this. Most likely the string is set up with
SSPI, which requires the accounts accessing are trusted in the domain to
access SQL Server.

But, the issue can also be tied to the client libraries. If the library used
is named pipes, the server is stricter on who is trusted than TCP/IP. Watch
dinking around with the client libraries too much, however, as you can
introduce security holes.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"Ray Valenti" <RValenti (AT) neo (DOT) rr.com> wrote

Quote:
I am able to preview this data in the development environment, but when I
run the application the error below shows up.
How do I set up a Trusted Connection?

-Ray

Server Error in '/WebApplication2' Application.
--------------------------------------------------------------------------
--
----

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for
user
'(null)'. Reason: Not associated with a trusted SQL Server connection.








Reply With Quote
  #7  
Old   
Ray Valenti
 
Posts: n/a

Default Re: Trusted SQL Server connection - 11-17-2003 , 04:18 PM



Both TCP/IP and Named pipes are enabled on the client machine. I even moved
the database to my local machine and still get an error.

If I can configure a DSN why can't I use that as the connection string? Why
can't the connection string specify any user (me) thereby providing the same
rights?

I have a Win 2000 small business server, my client machine is XP. How can I
provide rights for the ASPNET user?

------------------------------------------------------
Login failed for user 'GORILLAZ\ASPNET'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'GORILLAZ\ASPNET'.




Reply With Quote
  #8  
Old   
Chris Bower
 
Posts: n/a

Default Re: Trusted SQL Server connection - 11-17-2003 , 04:37 PM



Did you try removing the Integrated Security=SSPI like I suggested earlier?

"Ray Valenti" <RValenti (AT) neo (DOT) rr.com> wrote

Quote:
Both TCP/IP and Named pipes are enabled on the client machine. I even
moved
the database to my local machine and still get an error.

If I can configure a DSN why can't I use that as the connection string?
Why
can't the connection string specify any user (me) thereby providing the
same
rights?

I have a Win 2000 small business server, my client machine is XP. How can
I
provide rights for the ASPNET user?

------------------------------------------------------
Login failed for user 'GORILLAZ\ASPNET'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for
user
'GORILLAZ\ASPNET'.






Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.