473,783 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trusted connection won't work...


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
strCN = "data source='DIVCS-SQL2\SQL2K';Tru sted_Connection =true;initial
catalog=Helpdes kDevelopment;Us er Id='" & objCurrentUser. Name & "'"

Where objCurrentUser is a WindowsIdentity object. This object is returning
the correct username.

I've done everything according to the book (ASP.NET unleashed) and I've
checked the knowledge base.

Thanks in advance....Paul
Nov 18 '05 #1
2 1629
With a trusted connection, you don't need to pass the User Id ... it will
use the current windows user credentials. In ASP.NET, this is typically the
asp worker process account. Does this account have access to your
helpdeskdevelop ment database? If not, it will need access and you'll need
to handle any extra security with custom login forms and back-end tables.

If you need to impersonate a windows user and use windows security instead,
you'll need to setup web.config correctly.

See
http://msdn.microsoft.com/library/de...tionSchema.asp
with particular attention to the <authentication >, <authorization> , and
<identity> elements.

Hope that helps.
Sam

"Paul M" <ma****@trials. bham.ac.uk> wrote in message
news:O1******** ******@TK2MSFTN GP09.phx.gbl...

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
strCN = "data source='DIVCS-SQL2\SQL2K';Tru sted_Connection =true;initial
catalog=Helpdes kDevelopment;Us er Id='" & objCurrentUser. Name & "'"

Where objCurrentUser is a WindowsIdentity object. This object is returning the correct username.

I've done everything according to the book (ASP.NET unleashed) and I've
checked the knowledge base.

Thanks in advance....Paul

Nov 18 '05 #2
Hi Paul,

Asp.net applications run under local windows aspnet account.
Thus, trusted connections will
a) ignore User Id
b) use aspnet account to log in to sql server.

You have at least tow options at this point:
a) run your app under different windows account (that is trusted to sql
server)
Example:
Just put a line into web.config file somewhere under
<system.web> node:

<identity impersonate="tr ue" userName="USER" password="PASSW ORD"/>

b) use sql server authentication

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Paul M" <ma****@trials. bham.ac.uk> wrote in message
news:O1******** ******@TK2MSFTN GP09.phx.gbl...

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
strCN = "data source='DIVCS-SQL2\SQL2K';Tru sted_Connection =true;initial
catalog=Helpdes kDevelopment;Us er Id='" & objCurrentUser. Name & "'"

Where objCurrentUser is a WindowsIdentity object. This object is returning the correct username.

I've done everything according to the book (ASP.NET unleashed) and I've
checked the knowledge base.

Thanks in advance....Paul

Nov 18 '05 #3

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

Similar topics

2
16494
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 =...
7
7824
by: KathyK | last post by:
Hi and thanks in advance! I have an Access 2000 front end and a SQL Server 2000 back end. When the Access main form opens I run code that logs the user on to the SQL server using the generic read only log on I have created. On some PCs I am having a problem. The code runs and then displays a Log On box with the Trusted Connection checked and the users NT logon displayed. What causes this? Is there a way to correct it? Thanks! Kathy
1
3332
by: Peter Afonin | last post by:
Hello: I need to execute a DTS package from an ASP.Net application. The SQL server registration properties are set to "Use Windows authentication". domain\ASPNET is among the SQL server users. However, when I use this string to load DTS package: oPkg.LoadFromSQLServer("WIN2000", , , DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection, , , ,
7
2166
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 '/WebApplication2' Application. ---------------------------------------------------------------------------- ----
4
7227
by: rrober07 | last post by:
Hello, My Setup is I have a Web Server machine(Devweb01), Database SQL Machine(Devsql01), a Client Machine(local machine) I have configured the SQL machine as follows: 1) Added local Aspnet user account (with same password as aspnet user on IIS (Devweb01)) 2) edited local machine.config file <ProcessModel> Password attribute to same password (both on IIS and SQL Machine) 3) SQL Server security is Sql Server and Windows
2
1772
by: Paul M | last post by:
Hi folks, Just want to make sure I've got this right. I've got an application I want to authenticate to the domain i.e. an intranet app. I've set this up (all the web.config items are in place and everythings tickety boo) and I can get the username and various other bits of info from a WindowsIdentity object. So far so good. When I try and connect to my SQL 2K server however using a trusted
5
1886
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...
2
2289
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 followed articles on the web and enabled "SQL Server and Windows Authentication" for my SQL Server 2005. But, it does not solve my problem. (It is actually my default setting for my SQL Server)
3
6634
by: Kevinp | last post by:
I'm trying to get my program to connect to a SQL Server 2005 database over the internet. The remote computer is on another network and it's connected to our network through Windows VPN. I'm running Windows Small Business Server 2005 on our server with SQL Server 2005 and ISA Server 2004. I can do this at home with my laptop using the following connection string: strCnn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security...
0
9643
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
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
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
10083
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
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
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.