Thursday, March 22, 2012

Login Only Works Locally

I developed locally (like a good little programmer-bee). After I copied the pages to the server, I can't login through the login control. It's giving me a error as if I'm not a legitimate user. I tried all the user/name combo's that I registered through the Web Admin tool, as well as, creating new ones and no dice. Still doesn't work. I checked the database to make sure the user info was in there and it's all there. I have my own providers defined and the database connection in the config hasn't changed.

Any ideas what this could be? The only thing that has changed is the location of files.

What is the error you are getting?

Hi,

r u using SQL express database which is inside App_data folder? and you have uploaded on the server... Can u explain little bit more where is ur database?


I ran into this problem a couple months ago. This article helped me get everything working on server.

Very important post to anyone who wants to deploy website from local machine to a host server. I struggled for weeks trying to figure out how to deploy my Security/Mebership enabled website from my local machine to a host server. The following link will show you how to do this.

http://help.maximumasp.com/SmarterTicket/Customer/KBArticle.aspx?articleid=878


If you have created the logins in your local system and then deployed the application in another server, then theapplicationName differs and the logins wont work. You need to specify the applicationName in the web.config file. Check this link for more informationhttp://weblogs.asp.net/scottgu/archive/2006/04/22/Always-set-the-_2200_applicationName_2200_-property-when-configuring-ASP.NET-2.0-Membership-and-other-Providers.aspx

Thanks


I'm terribly sorry.  Should have posted more info.

I'm running SQL Express on the server. I created the login database on the server using Aspnet_regsql.exe. Then made corresponding changes to the web.config to point to it. All was good locally, even though I was always pointing to the external database located on the server (connection string didn't need to be changed). The error I get is:

Your login attempt was not successful. Please try again.

This error is the error message for the login control. Kinda stumped here.

Here is the web.config just in case you want a looksey:

1
2 <!--3 Note: As an alternative to hand editing this file you can use the
4 web admin tool to configure settings for your application. Use
5 the Website->Asp.Net Configuration option in Visual Studio.
6 A full list of settings and comments can be found in
7 machine.config.comments usually located in
8 \Windows\Microsoft.Net\Framework\v2.x\Config
9 -->
10 <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
11 <appSettings/>
12 <connectionStrings>
13 <!--<add name="CustodialConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\matt\WebSite\App_Data\Custodial.mdb"
14 providerName="System.Data.OleDb" />-->
15 <add name="CustodialConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\172.16.30.35\www\App_Data\Custodial.mdb" providerName="System.Data.OleDb"/>
16 <add name="MaintSQLConnectionString1" connectionString="Data Source=CUSTODIAL\SQLEXPRESS;Initial Catalog=MaintSQL;Persist Security Info=True;User ID=sa;Password=password"
17 providerName="System.Data.SqlClient" />
18 <!--<add name="LoginConnectionString" connectionString="Data Source=CUSTODIAL\SQLEXPRESS;Initial Catalog=MaintSQL;Persist Security Info=True;User ID=sa;Password=password"
19 providerName="System.Data.SqlClient" />-->
20 <!--<add name="MaintSQLConnectionString1" connectionString="Data Source=CUSTODIAL\SQLEXPRESS;Initial Catalog=MaintSQL;Persist Security Info=True;User ID=sa;Password=password"
21 providerName="System.Data.SqlClient" />-->
22 </connectionStrings>
23 <system.net>
24 <mailSettings>
25 <smtp>
26 <network host="custodial.trschools.com"
27 port="25"
28 defaultCredentials="true"
29 />
30 </smtp>
31 </mailSettings>
32 </system.net>
33 <system.web>
34
35
36 <!--
37 *###########################*
38 Membership Info
39 *###########################*
40 -->
41
42 <authentication mode="Forms">
43 <forms loginUrl="Login.aspx" />
44 </authentication>
45 <membership defaultProvider="LoginProvider">
46 <providers>
47 <add connectionStringName="MaintSQLConnectionString1" requiresQuestionAndAnswer="false"
48 minRequiredNonalphanumericCharacters="0" name="LoginProvider"
49 type="System.Web.Security.SqlMembershipProvider" />
50 </providers>
51 </membership>
52 <roleManager enabled="true" defaultProvider="RoleProvider">
53 <providers>
54 <add connectionStringName="MaintSQLConnectionString1" name="RoleProvider"
55 type="System.Web.Security.SqlRoleProvider" />
56 </providers>
57 </roleManager>
58
59
60 <compilation debug="true" strict="true" explicit="true">
61 <assemblies>
62 <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
63 <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
64 <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
65 </assemblies>
66 </compilation>
67 <pages maintainScrollPositionOnPostBack="true">
68 <namespaces>
69 <clear/>
70 <add namespace="System"/>
71 <add namespace="System.Collections"/>
72 <add namespace="System.Collections.Specialized"/>
73 <add namespace="System.Configuration"/>
74 <add namespace="System.Text"/>
75 <add namespace="System.Text.RegularExpressions"/>
76 <add namespace="System.Web"/>
77 <add namespace="System.Web.Caching"/>
78 <add namespace="System.Web.SessionState"/>
79 <add namespace="System.Web.Security"/>
80 <add namespace="System.Web.Profile"/>
81 <add namespace="System.Web.UI"/>
82 <add namespace="System.Web.UI.WebControls"/>
83 <add namespace="System.Web.UI.WebControls.WebParts"/>
84 <add namespace="System.Web.UI.HtmlControls"/>
85 </namespaces>
86 </pages>
87 <!--
88 The <authentication> section enables configuration
89 of the security authentication mode used by
90 ASP.NET to identify an incoming user.
91 -->
92 <!--
93 The <customErrors> section enables configuration
94 of what to do if/when an unhandled error occurs
95 during the execution of a request. Specifically,
96 it enables developers to configure html error pages
97 to be displayed in place of a error stack trace.
98
99 <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
100 <error statusCode="403" redirect="NoAccess.htm" />
101 <error statusCode="404" redirect="FileNotFound.htm" />
102 </customErrors>
103
104
105 -->
106 <customErrors mode="Off"/>
107 </system.web>
108 </configuration>
109


e_screw:

If you have created the logins in your local system and then deployed the application in another server, then theapplicationName differs and the logins wont work. You need to specify the applicationName in the web.config file. Check this link for more informationhttp://weblogs.asp.net/scottgu/archive/2006/04/22/Always-set-the-_2200_applicationName_2200_-property-when-configuring-ASP.NET-2.0-Membership-and-other-Providers.aspx

Thanks


OMG...thank you sooooo much. If anyone hasn't told you the love you today. "I Love You"!!!!

Big Smile K.I.S.I.S = Keep It Simple I'm Stupid!

Thanks

0 comments:

Post a Comment