ASP .NET 2.0 forms authentication doesn’t work after deployment

I was having trouble with getting my application to authenticate users when I deployed it to my host server. Typical story, everything worked fine when on my local development machine, including using the connection string to the host’s sql server. When deployed on the host, the login form would show and when I enter the credentials, the form would pass back to the default page, not displaying any error. It looks as though the user is authenticated, but the LoginView control doesn’t change as it does on my local machine. WHen I try and access a restricted part of the web site, I am (appropriately) directed to the login form but every time I enter my credentials it stays on the login form. So, what’s going on?
As it turns out, the forms element of the authentication section of the web.config has an attribute called "path" that, if set (along with the cookieless="AutoDetect|UseCookies"), has to relate to the path on the host. Because I was hosting it locally, path="/MySite" worked because of how it was set up on my local machine. It didn’t work on the host as I am not certain how they have it set up. I only get to see my own node in the tree. So, the fix was to not include the path attribute, leaving it at the default "/".

2 thoughts on “ASP .NET 2.0 forms authentication doesn’t work after deployment

  1. Thank you very much ! I’m french and I was desperate by this problem !Merci beaucoup !

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s