472,961 Members | 2,216 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,961 software developers and data experts.

Trusted SQL Server connection

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.

Nov 18 '05 #1
7 2113
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" <RV******@neo.rr.com> wrote in message
news:8j******************@fe1.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.


Nov 18 '05 #2
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" <RV******@neo.rr.com> wrote in message
news:8j******************@fe1.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.


Nov 18 '05 #3
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" <ch***********@SPAMunionfedbank.com> wrote in message
news:%2***************@TK2MSFTNGP10.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" <RV******@neo.rr.com> wrote in message
news:8j******************@fe1.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.



Nov 18 '05 #4
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" <RV******@neo.rr.com> wrote in message
news:4e*****************@fe2.columbus.rr.com...
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" <ch***********@SPAMunionfedbank.com> wrote in message
news:%2***************@TK2MSFTNGP10.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" <RV******@neo.rr.com> wrote in message
news:8j******************@fe1.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.




Nov 18 '05 #5
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" <RV******@neo.rr.com> wrote in message
news:8j******************@fe1.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.


Nov 18 '05 #6
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'.

Nov 18 '05 #7
Did you try removing the Integrated Security=SSPI like I suggested earlier?

"Ray Valenti" <RV******@neo.rr.com> wrote in message
news:7X******************@fe3.columbus.rr.com...
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'.

Nov 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: bigDWK | last post by:
Hi- Is it possible to do a trusted connection for a web server not on the same physical machine. By this I mean can I make a remote connection from a web server to a sql server using a trusted...
2
by: DMS | last post by:
am new to ASP.NET and IIS web applications, but not to SQL databases. I can successfully build Windows apps using Visual Studio that use ADO. However, for Web Forms, I created data connection and...
2
by: Blake Versiga | last post by:
I am pulling my hair out..... I am trying to put a bound data grid on a webform... I have 4 data connections in my server explorer, all of which connect successfully. But when I run the web...
4
by: Brian Henry | last post by:
I an trying to connect to a sql server in asp.net with the sql connection object, and every time i try to open the connection i get this Server Error in '/' Application. Login failed for user...
2
by: Paul M | last post by:
Hi, I've just implemented my first application onto a test web server. When the code comes to creating a connection object it throws an error saying the "Login failed for user '(null)'. Reason...
5
by: Adam Getchell | last post by:
Hello all, I've read over: http://idunno.org/dotNet/trustedConnections.aspx I would like to use a trusted connection vice using encrypted database strings:...
5
by: Mythran | last post by:
I have a test server and a development machine. I have SQL Server installed on both, the installations are pretty much identical. Both servers are in the same domain. When I run my application...
3
by: Mad Scientist Jr | last post by:
I am getting the following error when trying to access a database with a trusted connection: "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection." My...
4
by: eruth | last post by:
There are loads of post on this, but nothing that seems to cover my exact problem ;) I have an ASP.Net 1.1 web application running on my local machine. I want to connect to an SQL 2005 server...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.