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\developmentser vername$'.
System.Data.SqlClient.SqlE xception: Login failed for user 'company\developmentsevern ame
I have enabled permissions on the content directory for user 'company\developmentsevern ame
so, that looks to be ok.
I don't understand what's wrong.
I have even tried adding company\developmentseverna me 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;Integrat ed Security=SSPI;Initial Catalog=dbname; User ID=sa;Password=xxx" providerName="System.Data. SqlClient" />
</connectionStrings>
<system.web>
<roleManager enabled="true" />
<membership defaultProvider="portal_in sProvider" >
<providers>
<add name="portal_insProvider"
type="System.Web.Security. SqlMembers hipProvide r, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=blah"
connectionStringName="Loca lSqlServer " />
</providers>
</membership>
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" defaultUrl="~/LoginView.as px" />
</authentication>
</system.web>
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\developmentser
System.Data.SqlClient.SqlE
I have enabled permissions on the content directory for user 'company\developmentsevern
so, that looks to be ok.
I don't understand what's wrong.
I have even tried adding company\developmentseverna
Here is a parred down version of my top level config file
<appSettings/>
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="data source=liveDBName;Integrat
</connectionStrings>
<system.web>
<roleManager enabled="true" />
<membership defaultProvider="portal_in
<providers>
<add name="portal_insProvider"
type="System.Web.Security.
connectionStringName="Loca
</providers>
</membership>
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" defaultUrl="~/LoginView.as
</authentication>
</system.web>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
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"
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
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
ASKER
In the application management tool, there was only one link to test the provider.
It was for the ASPNETSQLMembership provider.
Example:
AspNetSqlMembershipProvide
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
AspNetSqlMembershipProvide
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?