473,625 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Sql Client.SqlExcep tion: Login failed for user
'(null)'. Reason: Not associated with a trusted SQL Server connection.

Nov 18 '05 #1
7 2156
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.r r.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.Sql Client.SqlExcep tion: 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.r r.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.Sql Client.SqlExcep tion: 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;p ersist security info=True;works tation id=MYWORKSTAT;p acket
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***********@ SPAMunionfedban k.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.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.r r.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.Sql Client.SqlExcep tion: 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.r r.com> wrote in message
news:4e******** *********@fe2.c olumbus.rr.com. ..
Chris,

The connection string is:

strConnect = @"data source=MYSERVER ;initial catalog=MainDb; integrated
security=SSPI;p ersist security info=True;works tation id=MYWORKSTAT;p acket
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***********@ SPAMunionfedban k.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.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.r r.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.Sql Client.SqlExcep tion: 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.r r.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.Sql Client.SqlExcep tion: 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\ASPNE T'.
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.Sql Client.SqlExcep tion: Login failed for user
'GORILLAZ\ASPNE T'.

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

"Ray Valenti" <RV******@neo.r r.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\ASPNE T'.
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.Sql Client.SqlExcep tion: Login failed for user 'GORILLAZ\ASPNE T'.

Nov 18 '05 #8

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

Similar topics

2
7056
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 connection. If so, how? Thanks, Dave
2
16490
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 sqladapter to my SQL Server - Northwind - which I dragged from Server Explorer. I generate a dataset, and Preview Data in the da, works fine. I then enter vb code on Page_Load event: SqlDataAdapter1.Fill(ds) DataGrid1.DataSource =...
2
31103
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 page I get the error: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. I use a connection string in my application in several other pages with no
4
2072
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 '(null)'. Reason: Not associated with a trusted SQL Server connection. why am i getting this? and how do i get around it? I am logged into the domain on the machine that the asp.net system is on, the sql server is a
2
1620
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 : Not associated with a trusted connection". I'm using integrated security and it works from the IIS server I have set up on my local machine. The connection string I'm using is
5
1489
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: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT11.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT11.asp
5
1879
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 locally, I can connect to the local sql server as well as the sql server on the test server. The IIS settings on both the test server and local machine are the same (anon disabled, use integrated windows auth). Identity impersonate is on in...
3
5760
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 connection string is: "Server=MyServer; Database=MyCatalog; Trusted_Connection=True;"
4
12072
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 running on Windows 2003. If I use SQL authentication, all is fine and dandy. If I want to use windows authentication it gives the above error. My SQL server is set to allow both methods (first thing I checked) and is part of the domain (2nd...
0
8253
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8692
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1499
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.