Results 1 to 6 of 6

Thread: Problem with login to ASP.NET Membership services database

  1. #1
    Join Date
    Mar 2010
    Posts
    54

    Problem with login to ASP.NET Membership services database

    I've done some work on an existing application, and application to hear the two databases. An ASP.NET Membership services database that stores the login details, and a database that stores application specific data. I restored both databases locally, and had no problems connecting to them with integrated security = SSPI in connection string during development (from Visual Studio 2008). I have published the solution to the IIS on the prod server, and restored both databases. My problem is I cannot connect to the ASP.NET Membership services database. I get logged into the management studio with the user I have in connection strings, and gets run queries on both databases. I have the following connection strings:

    Code:
    <add connectionString = "Server=****\**;Database=FNAuthentication;User ID=***;Password=***" name = "AuthenticationConnectionString" /> 
    <add connectionString = "Server=****\**;Database=AppDB;User ID=***;Password=***" name = "AppDBConnString" />
    When connecting I get the following error message:

    [SqlException (0x80131904): Cannot open database "FNAuthentication" requested by the login. The login failed.
    Login failed for user '***'.]
    System.Data.SqlClient.SqlInternalConnection.onerror(SqlException exception, Boolean breakConnection) +6244425
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +245
    System.Data.SqlClient.TdsParser.Run(Runbehavior runbehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2811
    System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +53
    System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +248
    System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +6260362
    System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +6260328
    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +354
    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +703
    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +54
    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +6261592
    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +81
    System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1657
    System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +88
    System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6265031
    System.Data.SqlClient.SqlConnection.Open() +258
    System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +82
    System.Web.DataAccess.SqlConnectionhelper.GetConnection(String connectionString, Boolean revertImpersonation) +3986458
    System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +3053172
    System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +213
    System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +164
    System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +75
    System.Web.UI.WebControls.Login.AttemptLogin() +152
    System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +124
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
    The error message makes me believe that there are problems with rights, but I do not know where / what to make changes.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: Problem with login to ASP.NET Membership services database

    Have you tested logging in prodmachines with explicit username/password as in connectionstring? And try also with "Trusted_Connection = False;" in connection string. Note that this is not the syntax for logging in with a Windows user, but is SQL auth to SQL server. Classic is if this is the username/password for a user on the server - it is wrong syntax. That is - if you want to run a specific Windows user, as seen by the user rights you have in the Application Pool, using SSPI.

  3. #3
    Join Date
    Mar 2010
    Posts
    54

    Re: Problem with login to ASP.NET Membership services database

    I am not quite sure what you mean. The machine I'm logged on is having the computer name/user name + password (windows login). The user I have in the connection string is a user on SQL Server to SQL Authentication (who said that in general do not work in the connection string to the FNAuthentication either. Locally, I hook myself up with both SSPI and said user.)

    I tested with this connectionstring:

    Code:
    <add connectionString="Server=****\**;Database=FNAuthentication;User ID=***;Password=****;Trusted_Connection=False" name="AuthenticationConnectionString" />
    And got the same error message:

    Cannot open database "FNAuthentication" requested by the login. The login failed.
    Login failed for user '***'.
    The strange thing is that the user works with the other database.

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: Problem with login to ASP.NET Membership services database

    Do it on one database and not the other, it should be easy to troubleshoot. Double check the server name, database name, user name and password. Verify that you can manually log on both SQL databases with SQL authentication and username/password. The best thing is that SQL Authentication is not enabled for the database server/database. But this should be able to find out by logging on the server with that username/password. You do not have any special characters in your password? Ambersand, accented characters, etc., then it could be html coding issues, in spite of everything here is in an XML file?

  5. #5
    Join Date
    Mar 2010
    Posts
    54

    Re: Problem with login to ASP.NET Membership services database

    Thanks again! It's the same user I use in both connections. I get logged into the management studio with the user (SQL Server Authentication), and gets run queries on both databases. The problem only occurs when I log on from ASP.NET. There are no strange characters in the username/password, and I know that the combination of username/password works as AppDBConnString works. Both databases are on the same server.

  6. #6
    Join Date
    Nov 2005
    Posts
    1,323

    Re: Problem with login to ASP.NET Membership services database

    Make sure that the username is correct, there is no typo error in the same. Then try to give the complete name like <database>.<owner>.<procedurename> and check if it is having the appropriate permissions to access the database. Also confirm if the user is having the appropriate permission. At the end make sure the ASP.NET is connecting to the right server "instance". To check this you can use the SQL profiler.

Similar Threads

  1. Replies: 4
    Last Post: 16-06-2011, 07:03 AM
  2. Connection failed for the database login
    By Indivar in forum Software Development
    Replies: 5
    Last Post: 18-11-2010, 12:03 AM
  3. Single database & multiple functions in web services.
    By Kiran123 in forum Software Development
    Replies: 2
    Last Post: 31-01-2009, 04:24 PM
  4. Replies: 2
    Last Post: 20-04-2007, 07:30 PM
  5. Group membership login script
    By Wooody in forum Small Business Server
    Replies: 1
    Last Post: 26-02-2007, 04:38 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,710,821,472.40056 seconds with 17 queries