473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

trusted sql server connection problem!?

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
seperate machine... vs.net can do a preview of the data and read it in
vs.net ide, and i can connect and retrieve data using the server explorer,
but when i do it programaticly it gives me that error... here is my
connection sub...
Private dbconnectionstring As String = "workstation id=DELL5100;packet
size=4096;integrated security=SSPI;data source=BENE-SQL;persist security
info=False;initial catalog=ReschIntranet"
Public dbconnection As New SqlClient.SqlConnection(dbconnectionstring)
Nov 17 '05 #1
4 2045
confirm what account the web app is using to log into sql server. Its been
a while since I did any asp.net, but I recall this being an issue then and
we had to make sure the 'asp.net user' could log into sql server...or
something along those lines.
"Brian Henry" <br******@adelphia.net> wrote in message
news:eC**************@TK2MSFTNGP10.phx.gbl...
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
seperate machine... vs.net can do a preview of the data and read it in
vs.net ide, and i can connect and retrieve data using the server explorer,
but when i do it programaticly it gives me that error... here is my
connection sub...
Private dbconnectionstring As String = "workstation id=DELL5100;packet
size=4096;integrated security=SSPI;data source=BENE-SQL;persist security
info=False;initial catalog=ReschIntranet"
Public dbconnection As New SqlClient.SqlConnection(dbconnectionstring)

Nov 17 '05 #2
This is because during development, it is using your integrated security
authentication to connect to the database.

At run time, ASPNET is what's trying to connect, and it is not associated
with a trusted connection.

So you can either set up ASPNET as a user with rights, or just use a
username/password account and pass that in to sql server when trying to
connect.

"Brian Henry" <br******@adelphia.net> wrote in message
news:eC**************@TK2MSFTNGP10.phx.gbl...
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
seperate machine... vs.net can do a preview of the data and read it in
vs.net ide, and i can connect and retrieve data using the server explorer,
but when i do it programaticly it gives me that error... here is my
connection sub...
Private dbconnectionstring As String = "workstation id=DELL5100;packet
size=4096;integrated security=SSPI;data source=BENE-SQL;persist security
info=False;initial catalog=ReschIntranet"
Public dbconnection As New SqlClient.SqlConnection(dbconnectionstring)

Nov 17 '05 #3
or what we do here, is switch the web site to run on itegrated security
(assuming working locally), then it will pass your credentials. also, you
will need to set the identity impersonate=true in the web.config.

jim
"Brian Henry" <br******@adelphia.net> wrote in message
news:eC**************@TK2MSFTNGP10.phx.gbl...
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
seperate machine... vs.net can do a preview of the data and read it in
vs.net ide, and i can connect and retrieve data using the server explorer,
but when i do it programaticly it gives me that error... here is my
connection sub...
Private dbconnectionstring As String = "workstation id=DELL5100;packet
size=4096;integrated security=SSPI;data source=BENE-SQL;persist security
info=False;initial catalog=ReschIntranet"
Public dbconnection As New SqlClient.SqlConnection(dbconnectionstring)

Nov 17 '05 #4
As you are using integrated security, you will want to do one of the
following:

1. Assign the IUSR account rights to the database (bad idea, but easy)
2. Change to mixed mode security (better, and still quite easy)
3. Create a user account to access the SQL Server and have the data routines
assume that identity when calling the database (programming heavy)
4. Restrict the web app to accounts that have permission to use SQL Server
in your domain (will not work for Internet apps)

The IDE runs under your account, the web app runs under IUSR unless you
restrict it.

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

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"Brian Henry" <br******@adelphia.net> wrote in message
news:eC**************@TK2MSFTNGP10.phx.gbl...
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
seperate machine... vs.net can do a preview of the data and read it in
vs.net ide, and i can connect and retrieve data using the server explorer,
but when i do it programaticly it gives me that error... here is my
connection sub...
Private dbconnectionstring As String = "workstation id=DELL5100;packet
size=4096;integrated security=SSPI;data source=BENE-SQL;persist security
info=False;initial catalog=ReschIntranet"
Public dbconnection As New SqlClient.SqlConnection(dbconnectionstring)

Nov 17 '05 #5

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

Similar topics

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: epaetz | last post by:
I'm getting Not associated with a trusted SQL Server connection errors on a .Net windows service I wrote, when it's running on my application server. It's not a problem with mixed mode...
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...
5
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...
7
by: Ray Valenti | last post by:
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...
2
by: Frederik | last post by:
Hi, First sorry for my english I'm french. I developped a web app that work good under XPDEVSERVER machine (iis5) and SqlServerDevelopper Edition. I get problem when I moved this app to an...
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...
2
by: gnewsgroup | last post by:
OK, I know this has been a popular question from newbies. But, please don't haste to reply yet. I've googled and tested for a few hours, and cannot have this problem resolved. I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.