This project is read-only.

Login failed for user on web app startup

Topics: Developer Forum, Project Management Forum, User Forum
Jan 22, 2009 at 3:32 AM
Hello everyone,

I just downloaded the web app and once I launched the app in debug mode, I get a connection error.

I am running Vista SP2 w/ VS 2008 Pro Edition.  Using SQL 2008 express and looks like the database attached okay.  I ran the script to add the user as explain on the readme.txt.  Since this is a offline test site, I kept the default user/pass.

Here is what I am seeing - please, any help or ideas?

Login failed for user 'DBuserName'.

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 'DBuserName'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Jan 22, 2009 at 5:26 PM
Can I see your web.config entry for your connection string to the db please?
Jan 23, 2009 at 12:05 AM
Edited Jan 23, 2009 at 12:06 AM
Hi,

thanks for looking into this.

Below is the configuration in the web.config.  Just a note: I am running the site through VS 2008 and through IIS.
 
<
connectionStrings>
<
remove name="LocalSqlServer"/>
<
add name="LocalSqlServer" connectionString="server=.\SQLEXPRESS;Initial Catalog=TheBeerHouse;uid=DBuserName;pwd=SecretPassword" providerName="System.Data.SqlClient"/>
</connectionStrings>
Jan 23, 2009 at 12:09 AM
Edited Jan 23, 2009 at 12:11 AM

Hi,

Not sure if this is helpful but here is the stack trace and error I am getting.

 

Server Error in '/TBH_Web' Application. 

 

Login failed for user 'DBuserName'.

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 'DBuserName'.

Source Error:

Line 118:    public virtual string Culture {
Line 119:        get {
Line 120: return ((string)(this.GetPropertyValue("Culture")));Line 121:        }
Line 122:        set {

Source File: c:\Users\jlaurence\AppData\Local\Temp\Temporary ASP.NET Files\tbh_web\a5046721\e4ff9d7b\App_Code.fqyolzut.26.cs    Line: 120

Stack Trace:

[SqlException (0x80131904): Login failed for user 'DBuserName'.]
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +428
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
   System.Data.SqlClient.SqlConnection.Open() +122
   System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +87
   System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +221
   System.Web.Profile.SqlProfileProvider.GetPropertyValuesFromDatabase(String userName, SettingsPropertyValueCollection svc) +772
   System.Web.Profile.SqlProfileProvider.GetPropertyValues(SettingsContext sc, SettingsPropertyCollection properties) +433
   System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider) +258
   System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName) +132
   System.Configuration.SettingsBase.get_Item(String propertyName) +102
   System.Web.Profile.ProfileBase.GetInternal(String propertyName) +36
   System.Web.Profile.ProfileBase.get_Item(String propertyName) +68
   System.Web.Profile.ProfileGroupBase.GetPropertyValue(String propertyName) +26
   ProfileGroupPreferences.get_Culture() in c:\Users\jlaurence\AppData\Local\Temp\Temporary ASP.NET Files\tbh_web\a5046721\e4ff9d7b\App_Code.fqyolzut.26.cs:120
   MB.TheBeerHouse.UI.BasePage.InitializeCulture() in c:\development\website\TheBeerHouse\TBH_Web\App_Code\BasePage.cs:19
   ASP.default_aspx.__BuildControlTree(default_aspx __ctrl) in c:\development\website\TheBeerHouse\TBH_Web\Default.aspx:1
   ASP.default_aspx.FrameworkInitialize() in c:\development\website\TheBeerHouse\TBH_Web\Default.aspx.cs:912308
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +56
   System.Web.UI.Page.ProcessRequest() +80
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.default_aspx.ProcessRequest(HttpContext context) in c:\Users\jlaurence\AppData\Local\Temp\Temporary ASP.NET Files\tbh_web\a5046721\e4ff9d7b\App_Web_9p8xcjue.12.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

 

Jan 23, 2009 at 1:04 AM
Hi,

DBuserName and SecretPassword are place holders for your actual username for the database and your actual password.  That is why you cannot login, you need to enter the correct username and password.
Jan 23, 2009 at 2:46 AM
Hi,

Thank you for the reply.  This may be a noob question but I am rather new to asp.net.  I been mostly a C++ developer for the better part of my career. 

When you are sayying username - are you referring to the login for SQL express 2008?  If so, when I installed SQL 20008 express, I used Windows authentication and opted not to create a user\pass admin.  Can I just use windows authentication with the currently logged in user?

I google around and found the option to add <authentication mode="Windows"/> but this did not seem to help.

Jan 23, 2009 at 2:59 AM
Found the resolution.  I had to add the following to the connection string - 

 

Integrated Security=True