ASP.NET using ADO.NET connection runtime error

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

I created a simple ASP.NET using ADO.NET application to connect to SQL
Server. However, it produces the following run-time error. I think ASPNET is
the ASP.NET machine account created by VS.NET, and I already added ASPNET in
IIS Manager in directory security tab, and disable the checkbox of anonymous
access. Unfortunately, it still not able to solve the problem. Any good
suggestions?? Thanks!

Exception Details: System.Data.SqlClient.SqlException: User
'MYComputerName\ASPNET' Registered Failure.

Source Error on line 37:

Line 35: Dim cs As String = "Data Source=MyComputerName;Integrated
Security=SSPI;Persist Security Info=False;Initial
Catalog=autoattendant;Trusted_Connection=yes"
Line 36: Dim cn As New SqlConnection(cs)
Line 37: cn.Open()
Line 38: Response.Write("string = " & cn.ConnectionString)
Line 39: End Sub

Source File: E:\web\WebApplication2\WebForm1.aspx.vb Line: 37

Stack Trace:

[SqlException: User 'TRUSTGOD\ASPNET' Registered Failed]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
WebApplication2.WebForm1.Submit1_ServerClick(Object sender, EventArgs e)
in E:\web\WebApplication2\WebForm1.aspx.vb:43
System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e)

System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
 
If you want to use "Integrated Security=SSPI" in the connect string, then
use impersonation.
As you already disabled anonymous, make the following entry in the
"web.config" file, right under the line that says
<system.web> add a line that says
<identity impersonate="true"/>
 
Back
Top