Link to home
Start Free TrialLog in
Avatar of LT1415
LT1415

asked on

Error using ASP.NET Membership API: Login Failed

I have build a  Web Site with Membership and User Login (Visual Studio)
http://msdn2.microsoft.com/en-us/library/879kf95c(VS.80).aspx.

I did not use the ASPNET.MDF, but used a SQL Server data base, created by executing
aspnet_regsql.exe. I am using SA + password to authenticate into the database.
I refered to this below link and my config file is similar.
http://forums.asp.net/899888/ShowPost.aspx

Everything worked great from my local, but now that I've deployed it to the development server, it is
blowing up at first login with an Error:

Login failed for user 'Comanyname\developmentservername$'.
System.Data.SqlClient.SqlException: Login failed for user 'company\developmentsevername

I have enabled permissions on the content directory for user 'company\developmentsevername
so, that looks to be ok.

I don't understand what's wrong.
I have even tried adding company\developmentsevername to the project as a user but no luck.

Here is a parred down version of my top level config file
      <appSettings/>
      <connectionStrings>
            <remove name="LocalSqlServer" />
            <add name="LocalSqlServer" connectionString="data source=liveDBName;Integrated Security=SSPI;Initial Catalog=dbname; User ID=sa;Password=xxx"  providerName="System.Data.SqlClient" />
      </connectionStrings>
      <system.web>      
  <roleManager enabled="true" />
<membership defaultProvider="portal_insProvider">
<providers>
<add name="portal_insProvider"
      type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=blah"
      connectionStringName="LocalSqlServer"   />
       </providers>
       </membership>
             <authentication mode="Forms">
<forms loginUrl="~/Login.aspx" defaultUrl="~/LoginView.aspx" />
</authentication>
            </system.web>
ASKER CERTIFIED SOLUTION
Avatar of VICKRAM
VICKRAM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LT1415
LT1415

ASKER

Well, I thought that I did, but..maybe you are on to something.
In the application management tool,  there was only one link to test the provider.
It was for the ASPNETSQLMembership provider.
Example:
AspNetSqlMembershipProvider  Test    
portal_insProvider  

I clicked the only link that was there.

I see in another tutorial example, that there are  two links there for the custom provider
AspNetSqlMembershipProvider  Test    
MySqlMembershipProvider  Test  

I created the sql database after I had started by project, I added it to the config, went back in to the admin tool,  the name appeared in the application management tool, but no link to test it.

I thought everything was OK because I could add users, log in and the information would appear in the new sql db.

Any recommendations?
On the servere, in its Control Panel, click Administrative Tools -> Data Sources (ODBC)
See if the "liveDBName" exists under the "User DSN" or "System DSN" tabs

Since you say that it works locally, see if they exist on your local PC under any of the  Data Sources (ODBC)'s tabs.

Avatar of LT1415

ASKER

Um..When I open the tab you mentioned on the server with the database, all that's listed is called LocalServer. None of our databases our named there, but we aren't having trouble with any other apps.
When you say "other apps", are they .NET apps? In the connectionString you gave above, it says "data source=liveDBName"... see what it says for the other apps.. i guess it would say "data source=LocalServer"
Avatar of LT1415

ASKER

I started over, and created a new project and it's working.
I think the problem was that I changed membership providers after I had set up the project--going from aspnet.mdf to a sql server db. Even though I put the new info in the config file and tested the connection, I am guessing it worked because the local machine.config some how took over. The machine config relies on the default aspnet.mdf  I don't know really. I started over put the new membership provider info in the config file and then tested the connection. I deployed it and it seems to be working. Thank you for your suggestions