Have you got your ASPNETDB.mdf file under source control? I have found that the log in control doesn't work while this file is checked in. My current problem is that I can't get it to work at all once I deploy it to a remote
server... Hope this helps../
Hi guys, we are in the same boat! I am facing the same problem too. The authentication runs OK (sometimes working, sometimes not) in VWD but when running on
http://localhost/app , it failed to authenticate even though I am 1000% sure that my username and password is correct. Hope someone can help us on this. Thanks.
Hi again, guys, I tried enable the "Local Impersonation" to my administrator account on the local computer and it managed to solve the problem. Hope that it's of some help... I am a newbie too. Thanks.
I think the problems described here and unsolved in quite a few other posts on this forum, including
one from me, is that when you add a user using the Membership API it also stores the name of the application that was used to add it in the aspnet_Applications table. When a user is added from
a page running on the Visual Studio web server it is linked to a record in this table containing the name of the web site shown in solution explorer in VS.
When you run the site in IIS the application name seems to come from the IIS settings (on the Home or Virtual Directory tab in site properties).
If the application names do not match then the a user added on the VS server won't authenticate when the site and membership db are run in IIS.
To fix this I have updated the ApplicationName and LoweredApplicationName on my deployed database to match the IIS application name and all works well. I suppose ensuring that they are both
the same before adding any users or deploying the database would be an easier way to do things...
Thanks graham, that was very helpful. I kept wondering why the aspnetdb would have two applicationName's, one for "/" and one for "MyApplicationName" in the aspnet_application table. I also noticed that when I created a user, two users would be created, one
for each ApplicationName. I suspected that this was the problem as sometimes the login control would work but other times it wouldn't, but couldn't figure out how to change it. Just to clarify, if I wanted all the users to be added to the "/" ApplicationName,
I would add <applicationName="/"> to the membership and role sections of the web.config. After that, all users will be added to root. Is this correct? I didn't have this line in the web.config providers section which I believe was causing the aspnet_application
table to have two entries instead of one. Thanks again for shedding so much need light on the problem. I'm going to give it a shot right now.
ok, so I added to the web.config applicationName ="/" which seems to work fine. I no longer have two applicationNames in the aspnet_application table. However, what is happening now is if I use the registration control, sign up, everything works great. But
if I log out, which sends me to the login page, and I enter a username and password (the same I used for registration) I get an error message that states that the user is anonymous. I can Membership.IsValid() method and the user is valid. So my question
is: how to make the user not anonymous?
I am not sure what could be causing your problem but maybe you could try a couple of things:
Remove the <membership> section from your web.config altogther and let the application use the default one. If this fixes your problem then there must be something else wrong in your web.config
Delete the aspnetdb and then use the admin tool to re-add it just in case there are still some issues from having two application names
Also, this is a bit of a shot in the dark, are you using roles in your application and if so is that why the user isn't logging in?
I have been struggling with this issue for a while myself.
I had the applicationName="/" attrubiute in my web.config, and only had one entry in the applications table in ASPNETDB.
I tried to change that value to "ECMA" (the name of my application) and also change the values in the database. I only have one application record and one user record in my database, but I still can't log in when the app is deployed to IIS.
Is there anything else that needs to be done?
I am pasting the complete web.config file here:
<?
xml
version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
I tried to create a new website directly on the IIS instead of a file system web site. Using the default memebership settings, with nothing added to web.config, login worked.
Looking into the aspnetdb database, the application table contained one record with the applicationName set to "/", so it seems that the application works on IIS even when the application name in IIS is different from the application name in the database.
So now I need to see what happens to a web site that was created directly under IIS, when it is transferred to a different machine. If this works, then at least I know that I can continue developing and hope to find a solution to this problem later on.
gmpeng
Member
50 Points
10 Posts
Re: Login won't authenticate
Feb 13, 2006 02:32 PM|LINK
Have you got your ASPNETDB.mdf file under source control? I have found that the log in control doesn't work while this file is checked in. My current problem is that I can't get it to work at all once I deploy it to a remote server... Hope this helps../
Graham
www.lot31.co.uk
cckiat
Member
687 Points
145 Posts
Re: Login won't authenticate
Feb 13, 2006 03:01 PM|LINK
cckiat
Member
687 Points
145 Posts
Re: Login won't authenticate
Feb 13, 2006 03:06 PM|LINK
gmpeng
Member
50 Points
10 Posts
Re: Login won't authenticate
Feb 13, 2006 07:44 PM|LINK
Hi
I think the problems described here and unsolved in quite a few other posts on this forum, including one from me, is that when you add a user using the Membership API it also stores the name of the application that was used to add it in the aspnet_Applications table. When a user is added from a page running on the Visual Studio web server it is linked to a record in this table containing the name of the web site shown in solution explorer in VS.
When you run the site in IIS the application name seems to come from the IIS settings (on the Home or Virtual Directory tab in site properties).
If the application names do not match then the a user added on the VS server won't authenticate when the site and membership db are run in IIS.
To fix this I have updated the ApplicationName and LoweredApplicationName on my deployed database to match the IIS application name and all works well. I suppose ensuring that they are both the same before adding any users or deploying the database would be an easier way to do things...
Hope this helps with your issues...
Graham
Architecture, Visualisation, Design, 3d, Application, Web, Windows, Development, Liverpool, UK
gmpeng
Member
50 Points
10 Posts
Re: Login won't authenticate
Feb 14, 2006 08:57 AM|LINK
The cause of the issue I describe above is described by Scott Guthrie here:
http://forums.asp.net/1195920/ShowPost.aspx
Graham
Architecture, Visualisation, Design, 3d, Application, Web, Windows, Development, Liverpool, UK
erichar11
Member
140 Points
28 Posts
Re: Login won't authenticate
Feb 14, 2006 01:26 PM|LINK
erichar11
Member
140 Points
28 Posts
Re: Login won't authenticate
Feb 14, 2006 03:38 PM|LINK
gmpeng
Member
50 Points
10 Posts
Re: Login won't authenticate
Feb 15, 2006 05:28 AM|LINK
Hi
I am not sure what could be causing your problem but maybe you could try a couple of things:
Also, this is a bit of a shot in the dark, are you using roles in your application and if so is that why the user isn't logging in?
Hope this helps...
Graham
gabbyrozow
Member
80 Points
20 Posts
Re: Login won't authenticate
Feb 22, 2006 02:43 PM|LINK
Hi,
I have been struggling with this issue for a while myself.
I had the applicationName="/" attrubiute in my web.config, and only had one entry in the applications table in ASPNETDB.
I tried to change that value to "ECMA" (the name of my application) and also change the values in the database. I only have one application record and one user record in my database, but I still can't log in when the app is deployed to IIS.
Is there anything else that needs to be done?
I am pasting the complete web.config file here:
<?
xml version="1.0"?><!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<
configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"><
appSettings><
add key="ReportErrorsToMIS" value="False" /></
appSettings><
connectionStrings><
add name="ProductsConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Products.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /><
add name="UsersConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /></
connectionStrings><
system.web><!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
--><
roleManager enabled="true"/><
compilation debug="true" strict="false" explicit="true"/><
pages><
namespaces><
clear/><
add namespace="System"/><
add namespace="System.Collections"/><
add namespace="System.Collections.Specialized"/><
add namespace="System.Configuration"/><
add namespace="System.Text"/><
add namespace="System.Text.RegularExpressions"/><
add namespace="System.Web"/><
add namespace="System.Web.Caching"/><
add namespace="System.Web.SessionState"/><
add namespace="System.Web.Security"/><
add namespace="System.Web.Profile"/><
add namespace="System.Web.UI"/><
add namespace="System.Web.UI.WebControls"/><
add namespace="System.Web.UI.WebControls.WebParts"/><
add namespace="System.Web.UI.HtmlControls"/></
namespaces></
pages><!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
--><
authentication mode="Forms" /><!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
--><
profile enabled="true"><
properties><
add name="Products"/></
properties></
profile><
machineKey validationKey="C5B196E911240399B8B51836BDAE577AB5C325CCC6E23DF9E225C93789CC420FBD01B2A9239703676B68157B35EA6313B53AD3047132C2356F16E252264FA470" decryptionKey="99A3BA776B9926350B0B47E9A81771A4B6B31736AFE9C729" validation="SHA1" /><
membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="20"><
providers><
clear/><
add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="ECMA" requiresUniqueEmail="false" passwordFormat="Encrypted" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
</
providers></
membership></
system.web><
system.net><
mailSettings><
smtp from="gabbyr@radware.com"><
network defaultCredentials="true" host="APOLLO" password="" userName="gabbyr"/></
smtp></
mailSettings></
system.net></
configuration>gabbyrozow
Member
80 Points
20 Posts
Re: Login won't authenticate
Feb 23, 2006 06:45 AM|LINK
Additional discovery:
I tried to create a new website directly on the IIS instead of a file system web site. Using the default memebership settings, with nothing added to web.config, login worked.
Looking into the aspnetdb database, the application table contained one record with the applicationName set to "/", so it seems that the application works on IIS even when the application name in IIS is different from the application name in the database.
So now I need to see what happens to a web site that was created directly under IIS, when it is transferred to a different machine. If this works, then at least I know that I can continue developing and hope to find a solution to this problem later on.