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

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..

LVL 5
CollindsouzaAsked:
Who is Participating?
 
YZlatConnect With a Mentor Commented:
now open the web.config file and add the following line

<identity impersonate="true" />

right after
 <authentication mode="Windows" />
0
 
CollindsouzaAuthor Commented:
i tried adding <identity impersonate="true" /> immediately after <authentication mode="Windows" />
.. i still cant get it working
0
 
sandip132Commented:
try using sql server IP instead of NICEDEV1.
0
 
CollindsouzaAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.