It works on my development serve within Visual Studio 2010 but when I deploy the site to a testing environment it returns null. Can one explain? I tried googling it but no one was able to give a definitive answer.
I have a login page that is only a script. A user’s account can only be created by an administrator to the site. The user’s id is retrieved from a value within the http request. Once the login page retrieves this ID it’s used to check the .net membership user table for the user’s account. If the user exits they are authenticated.
I use the base.Getuser(string username, bool isOnline) method to return the MembershipUser object. If it’s not null, authenticate.
After some troubleshooting I was ableot find the problem. No applicationname was entered for the profile and roles provider in the web.config file. So when I published the site the vroot was used as the default application name for the published site.
Hers’e the article that helped me figure it out.
Always set the “applicationName” property when configuring ASP.NET 2.0 Membership and other Providers