468,168 Members | 1,514 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,168 developers. It's quick & easy.

not associated with a trusted SQL Server connection

DMS
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 = ds.Tables("Employees")
DataGrid1.DataBind()
When I build and browse (localhost), I get:
Server Error in myapp...SqlException: Login failed for
user (null). Reason: Not associated with a trusted SQL
Server connection. (I have since found error codes
SQLState 42000 and SQL Error 18452, which could be
permissions among other things, haven't found anything
detailed on how to fix this.) The SQL mode is Windows
auth.I've tried various settings in Web.config connection
string, tried configuring IIS Virtual Directory Managment
on SQL Server setting Integrated Security and I
downloaded the .NET framework onto SQL server. I still
get the error.
Perhaps my workstation version of IIS is not configured
properly(?); do I need an IIS-server edition? Would
appreciate any help, reference to articles, etc.

Jul 21 '05 #1
2 16262
Hello,

You may need to configure SQL Server so the ASPNET user account has login
permission. This article describes how to do that:
http://msdn.microsoft.com/library/de...us/vbcon/html/
vbtskaccessingsqlserveraslocaluser.asp. The article "Accessing SQL Server
from a Web application"
(http://msdn.microsoft.com/library/de...-us/vbcon/html
/vbconaccessingsqlserverfromwebapplication.asp) contains more general
information that may also be useful.

Hope this helps,
Molly

---
Molly Bostic
..NET Developer Platform User Education

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "DMS" <dy***********@hqisec.army.mil>
Subject: not associated with a trusted SQL Server connection
Date: Mon, 29 Sep 2003 12:19:26 -0700
Newsgroups: microsoft.public.dotnet.general

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 = ds.Tables("Employees")
DataGrid1.DataBind()
When I build and browse (localhost), I get:
Server Error in myapp...SqlException: Login failed for
user (null). Reason: Not associated with a trusted SQL
Server connection. (I have since found error codes
SQLState 42000 and SQL Error 18452, which could be
permissions among other things, haven't found anything
detailed on how to fix this.) The SQL mode is Windows
auth.I've tried various settings in Web.config connection
string, tried configuring IIS Virtual Directory Managment
on SQL Server setting Integrated Security and I
downloaded the .NET framework onto SQL server. I still
get the error.
Perhaps my workstation version of IIS is not configured
properly(?); do I need an IIS-server edition? Would
appreciate any help, reference to articles, etc.

--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).
Jul 21 '05 #2
Dyanna,

When you create the Connection on the page, it uses your connection information that you supply, probably set to use a Trusted
Connection to connect to SQL. At runtime, it tries to use a trusted connection again, but this time the application is not running
as you, the logged in user, but as ASPNet, the ASP .Net user account. You should set the ConnectionString on your SQLConnection
before doing the DataBind() in the Page_Load(), and instead of using a trusted connection, use a SQL user, or make sure that your
account under which you run the website is allowed to connect to your SQL Server.

Regards

Thys Brits
MCSD/MCSD.Net

"DMS" <dy***********@hqisec.army.mil> wrote in message news:0b****************************@phx.gbl...
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 = ds.Tables("Employees")
DataGrid1.DataBind()
When I build and browse (localhost), I get:
Server Error in myapp...SqlException: Login failed for
user (null). Reason: Not associated with a trusted SQL
Server connection. (I have since found error codes
SQLState 42000 and SQL Error 18452, which could be
permissions among other things, haven't found anything
detailed on how to fix this.) The SQL mode is Windows
auth.I've tried various settings in Web.config connection
string, tried configuring IIS Virtual Directory Managment
on SQL Server setting Integrated Security and I
downloaded the .NET framework onto SQL server. I still
get the error.
Perhaps my workstation version of IIS is not configured
properly(?); do I need an IIS-server edition? Would
appreciate any help, reference to articles, etc.


Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Brian Henry | last post: by
7 posts views Thread by Ray Valenti | last post: by
1 post views Thread by gcdp | last post: by
reply views Thread by kamranasdasdas | last post: by
reply views Thread by gcreed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.