Related Links

Login won't authenticate

I have set up security for my site through the Site Admin Tool through VWD. I'm using the ASPNETDB.MDF way. My web.config has authentication set to forms. I have a default.aspx with nothing on it and a login.aspx with a login control on it. I have one user
in my database and I can't get it to authenticate. Even when I type in my exact username and password is spits back with "Your login attempt was not successful. Please try again."

Re: Login won't authenticate

Yes, I've used the Site Admin Tool to create several users. I've tried them all and none of them work. None of them authenticate.

If I'm getting an error message from the form in red this means that it IS connecting to the database and actually checking; however, it's failing to match a user. I'm not getting any application errors.

Re: Login won't authenticate

I'm still not able to authenticate by typing my virtual directory right in to my browser. I ALWAYS have to go through the VWD "View in browser" option. How can I get this to work without going through the VWD?

Please help, I'm dying to play with these new security classes!!! Thanks.

Re: Login won't authenticate

Here's the deal. Usually I test my Web sites by going to http://localhost/virtualdirectory but when I'm trying to build sites with the VWD authentication won't work that way. Apparently I have to use the Website > View in browser command in VWD to get my
authentication to work and even then it only works sometimes, it's VERY fickle.

I DO NOT understand what the Asp.net development server icon is for in my system tray or any of this. I don't understand why I can't access my applications the way I used to and have them work!

I have a feeling it has something to do with the ASP.Net development server (whatever that is) and the ASPNETDB.MDF file and detaching. Please if anyone knows a resource that will explain this crap to me for the love of everything good and holy tell me!!!

This is so freaking frusturating this whole trying to develop with the VWD. Please help, thanks.

Re: Login won't authenticate

I had trouble with my admin tool running, and later even the application running, because my firewall was interfering with something (i don't know what) happening behind-the-scenes while running an asp.net 2.0 application.

If you do have a firewall, I suggest try allowing ALL traffic and see if that helps.

Re: Login won't authenticate

I have the same problem. If I try to login typing my (NO-IP) DNS, it doesn´t autenticate the user (
Your login attempt was not successful. Please try again).. If I press F5 in VWD, it does the same. But If press ctrl +F5 ,
start with no debugging, it simply works! .. I really don´t know whats going on, If someone can just throw me a line, y would really apreciate.

Re: Login won't authenticate

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../

Re: Login won't authenticate

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.

Re: Login won't authenticate

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.

Re: Login won't authenticate

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...

Re: Login won't authenticate

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.

Re: Login won't authenticate

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?

Re: Login won't authenticate

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.

Re: Login won't authenticate

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.

Re: Login won't authenticate

It certainly is confusing. The way I initially found out what was going on was to add a 'create user' page outside of the area of the site that required authentication. I uploaded it to IIS, created a user while the site was
running on the server rather than my dev machine, and then examined the aspnetdb to see what had been added. It was then that I realised that the application names didn't match.

Perhaps you could try this and see if it helps you diagnose your issue...