Solved

Error: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

Posted on 2006-10-31
4
228 Views
Last Modified: 2010-04-16
I Changed the connection string in my code to disable annonomys access and use Trusted_Connection instead..

Hence i changed the following Connection string :
[global::System.Configuration.DefaultSettingValueAttribute("server=NICEDEV1;user id = NICEPLANDEV; password=****; database=NICEContacts")]

To:

[global::System.Configuration.DefaultSettingValueAttribute("server=NICEDEV1;database=NICEContacts;Trusted_Connection=yes")]


the reason I did this is because i need to be able to know the identity of the user logging in so that i can use this in Audit trail.. hence i can trace what each user has done in terms of changes  and use this Machine authentication to Store his details against a row that is changed..

The problem is i get the following error when i use the second connection string..

The error is "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."

I have even unchecked the enable Anonomys access option in IIS for this project..

Please help..

0
Comment
Question by:Collindsouza
  • 2
4 Comments
 
LVL 35

Accepted Solution

by:
YZlat earned 500 total points
ID: 17843464
now open the web.config file and add the following line

<identity impersonate="true" />

right after
 <authentication mode="Windows" />
0
 
LVL 5

Author Comment

by:Collindsouza
ID: 17846509
i tried adding <identity impersonate="true" /> immediately after <authentication mode="Windows" />
.. i still cant get it working
0
 
LVL 12

Expert Comment

by:sandip132
ID: 17847323
try using sql server IP instead of NICEDEV1.
0
 
LVL 5

Author Comment

by:Collindsouza
ID: 17848800
when i use the IP instead of the server name.. i get the following error

An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

i checked the default settings and the part Allow remote connections is checked...

please help
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
XAML: Layout 8 25
Host asp.net pages 5 25
In WPF / C# binding a local database in code behind 1 24
Greetings C# program 17 57
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now