Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Whats wrong with my ConnectionString in Web.Config

Hi,
This is my first attempt in learning how to write Web program using VB.Net 2003 and ASP.Net. I don't understand why the error listed below occurred and how to fix it. Please help.

Here is the scenerio:-
I am using the SERVER EXPLORER objects to create ConnectionString and DataAdapter to populate a DataList control on the Web Form. When I execute it with "Start Without Debugging", the error list below pops up.

Login failed for user 'LENNIEDO-1P65RG\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'LENNIEDO-1P65RG\ASPNET'.

Source Error:

Line 138: '
Line 139: 'obtain the data
Line 140: daAuthors.Fill(DsAuthors1)
Line 141:
Line 142: Try


Source File: c:\inetpub\wwwroot\WebDataList\FrmDataList.aspx.vb Line: 140

Stack Trace:

[SqlException: Login failed for user 'LENNIEDO-1P65RG\ASPNET'.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
System.Data.SqlClient.SqlConnection.Open() +384
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
WebDataList.FrmDataList.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebDataList\FrmDataList.aspx.vb:140
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
[2295 byte] By [Lennie] at [2007-11-11 10:30:46]
# 1 Re: Whats wrong with my ConnectionString in Web.Config
Can u post ur connection string. There is something wrong there or the username ur using is not correct in the conn string.
Check the user name in the database server and use the same in the connstring.
i.netdeveloper at 2007-11-11 23:11:47 >
# 2 Re: Whats wrong with my ConnectionString in Web.Config
Hi I-NetDevloper,

This connectionstring was generated by I dragged the table from the SERVER EXPLORER. The name of my workstation is Lenniedo-1P65RG.

Thanks for helping out.

Here is the connectionstring from Web.Config.

<!-- SESSION STATE SETTINGS
By default ASP.NET uses cookies to identify which requests belong to a particular session.
If cookies are not available, a session can be tracked by adding a session identifier to the URL.
To disable cookies, set sessionState cookieless="true".
-->
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" />

<!-- GLOBALIZATION
This section sets the globalization settings of the application.
-->
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

</system.web>

<appSettings>
<add key="conPubs.ConnectionString" value="workstation id="LENNIEDO-1P65RG";packet size=4096;integrated security=SSPI;data source="LENNIEDO-1P65RG";persist security info=True;initial catalog=pubs" />
</appSettings>
Lennie at 2007-11-11 23:12:43 >