Those who prefer reading this site through RSS now can also subscribe for updates to .NET Tips & Tricks Community.
Users created with the membership API will be associated with applicationName value specified in provider declaration in web.config file. This diagramm shows how user is associated with applicationName in database:
When no applicationName attribute is configured, ASP.NET uses the application vroot path within the web-server to automatically calculate the applicationName to use when adding data to an ASP.NET Application Service database.
Now let's assume you develop an ASP.NET 2.0 application locally using Membership, Roles or Profile features and you haven't specified applicationName attribute. You create several new users. Because applicationName property was not specified your users were associated with auto calculated value (something like "/WebSite1").
This works fine when the application continues to run in the "/WebSite1" application virtual path. But if it is copied to another location or server with a different virtual path (for example: "/app1" or more commonly just "/"), then when the Membership APIs are used they will not "see" the users already in our database – since they will lookup membership data using a different application name and filter the users in the application_Users table accordingly. That is why you'll get a "Login attempt unsuccessful, please try again." message when you try to login.
The best way to prevent this from ever happening is to always specify the "applicationName" attribute when declaring your providers. One good default value to use is "/" – which is the root application name. This is the value specified for the default provider that ships with ASP.NET 2.0 (which by default stores the application service data within the ASPNETDB.MDF file under /app_data), and is why if you don't override the provider settings it will work if you copy an app to another machine.
P.S. The reason why the applicationName setting even exists in the first place is so that you can map multiple applications and sites to the same database.