472,976 Members | 1,236 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,976 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 2013
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: 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...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
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...
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...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.