October 11, 2004 at 11:27 am
I'm trying to connect my HTML Visual C# Asp.net program to the NorthWind Database and I keep getting this fail message:
Connection failed: no trusted sqlConnection, what do I need to do to the ms sql server 2000 to grant the trusted Connection?
Thanks
October 11, 2004 at 11:43 am
Frequently, web apps use a SQL account to connect. Are you sure that you are using a valid SQL account and passoword?
Aunt Kathi Data Platform MVP
Author of Expert T-SQL Window Functions
Simple-Talk Editor
October 11, 2004 at 11:48 am
Yes, i'm doing an assignment out of a book and they say you need to tell your DBA that you need to be granted trusted connection.
Thanks
October 11, 2004 at 11:53 am
OK, a trusted connection is usually a domain account. In that case, you don't put the username and password in the connection string. So, do you have a DBA or are you trying to connect to a SQL instance on your workstation?
Aunt Kathi Data Platform MVP
Author of Expert T-SQL Window Functions
Simple-Talk Editor
October 12, 2004 at 1:13 am
Hi,
I adivce u to check u r connection string. Alternatively u can look at http://www.connectionstrings.com/
HTH,
Sudheer
October 14, 2004 at 2:05 am
It's likely and possible that the ASPNet account has not been granted access to the Northwind database. You can add/change your connection string the web.config file in your C# .Net project to use windows authentication (your domain/username). Then, if your windows account already has access to the MSSQL Server, you're good to go.
Generally, whether using MSSQL or the MSDE, you will need to go into the MSSQL Enterprise Manager and give the ASPNET (e.g. machinename/ASPNET) rights to the database.
October 14, 2004 at 9:30 am
Hi Michael,
You need to figure out who (what account) is trying to access the database. It could be ASPNET account, it could be your user Windows account anything. It depends on your web.config files entries for <AUTHENTICATION> element See "<AUTHENTICATION> Element" MSDN article at
For plain C#.NET without Web see the MSDN article and related links at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconprincipal.asp
I am even not mentioning Component Services that may change the security context of your component.
To make your life easier use SQL Server tools open your Profiler, specify Audit Login, Audit Logout and Audit Login Failed events, start your program, let it fail and see who was trying to connect from your app to your database. Then you will understand what security context your app is running on. Then ask your DBA to GRANT ACCESS to this very Windows account.
To Kathi: SQLconnection class in .NET is a way to open a connection to SQL Server. It uses a standard connection string and may be both Integrated (Windows) Authentication like
myConnectionString = "Initial Catalog=Northwind;Data Source=localhost;Integrated Security=SSPI;"
or it may be SQL Server standard authentication. In this case it is Windows because of trusted connection error , so Michael really has to find out who is running the show when his app connects. Because it is his app Integrated Authentication, not his. It could be an app account, his Windows account, ASPNET account, explicitly specified domain account or whatever.
Yelena
Regards,Yelena Varsha
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply