error when connecting to database question in asp.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

this is the DSN connection string in web.confi

<add key="DSN" value="server=localhost;database=userDB;Integrated Security=SSPI" /

any idea regarding what is causing this following error message when the connection object trys to open
tia
d

Server Error in '/FormsAuth' Application
-------------------------------------------------------------------------------

Login failed for user 'CHODRON\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 'CHODRON\ASPNET'

Source Error:

Line 95: strCn=System.Configuration.ConfigurationSettings.AppSettings["DSN"].ToString()
Line 96: SqlConnection cn=new SqlConnection(strCn)
Line 97: cn.Open()
Line 98: tr
Line 99:


Source File: c:\inetpub\wwwroot\formsauth\userdb.cs Line: 97

Stack Trace:

[SqlException: Login failed for user 'CHODRON\ASPNET'.
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction
System.Data.SqlClient.SqlConnection.Open(
FormsAuth.UserDB.SaveNewUser(String UserName, String LastName, String FirstName, String email, String PasswordHash, String Salt, Boolean MustChangePassword) in c:\inetpub\wwwroot\formsauth\userdb.cs:9
FormsAuth.User.SaveNewUser(String UserName, String LastName, String FirstName, String email, String Password, Boolean MustChangePassword) in c:\inetpub\wwwroot\formsauth\user.cs:16
FormsAuth.Register.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\formsauth\register.aspx.cs:7
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +10
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +5
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +1
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +3
System.Web.UI.Page.ProcessRequestMain() +127
 
try using this connection string .....

<add key="DSN" value="server=localhost;database=userDB;uid=database user
name;pwd=database user password;Connection Lifetime=0"/>

if u need to hide the password, u have to use encrypted way to do it..

hope this helps,
CMA


dk said:
this is the DSN connection string in web.config

<add key="DSN" value="server=localhost;database=userDB;Integrated Security=SSPI" />

any idea regarding what is causing this following error message when the
connection object trys to open?
tia,
dk


Server Error in '/FormsAuth' Application.
-------------------------------------------------------------------------- ------

Login failed for user 'CHODRON\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 'CHODRON\ASPNET'.

Source Error:


Line 95: strCn=System.Configuration.ConfigurationSettings.AppSettings["DSN"].ToString
();
Line 96: SqlConnection cn=new SqlConnection(strCn);
Line 97: cn.Open();
Line 98: try
Line 99: {


Source File: c:\inetpub\wwwroot\formsauth\userdb.cs Line: 97

Stack Trace:


[SqlException: Login failed for user 'CHODRON\ASPNET'.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
FormsAuth.UserDB.SaveNewUser(String UserName, String LastName, String
FirstName, String email, String PasswordHash, String Salt, Boolean
MustChangePassword) in c:\inetpub\wwwroot\formsauth\userdb.cs:97
FormsAuth.User.SaveNewUser(String UserName, String LastName, String
FirstName, String email, String Password, Boolean MustChangePassword) in
c:\inetpub\wwwroot\formsauth\user.cs:168
FormsAuth.Register.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\formsauth\register.aspx.cs:72
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
 
Back
Top