I created a simple ASP.NET project, using VB.NET, with a Default.aspx and a login.aspx page. The Default.aspx page just has a simple text box. And the login.aspx page just has a login control. I used the visual studio "asp.net configuration" tool to set up a user and a password. I can run my web page just fine in "debug" mode - the login.aspx page opens fine and after I enter my user name and password, I get directed to my default.aspx page correctly.
When I publish my web-site, first of all I have to close visual studio and re-open it, or it says that another application is using my ASPNETDB.mdf file. After I publish the web site (I publish to http://Kangaroo/test_login - Kangaroo is my computer name and I am using IIS) and I enter my user name and password, I get the error "Your login attempt was not successful. Please try again." I am publishing to the same computer that I am debugging on. Also, if I don't have the login.aspx page in my project, publishing my web site works fine (so I know it is not a publishing problem).
did you make sure to specify an applicationname on the membership provider?
If you don't it'll use a different application name on your published site that it will on your local site and the information won't cross over
Thanks for the quick response. I think that I actually just figured this out myself. I did specify a membership provider and I am still developing and deploying on the same machine - so that wasn't the problem. What I actually needed to do was go to C:\Inetpub\wwwroot, right click on my web-site folder (which I called test_login), select the "security" tab, and set "users" to have read and write permissions.
I'm not sure whether or not this is a good thing to do, from a security point of view, but it does work now. Is there a better way to fix my problem than assiging all "users" to have read/write permission on the web site?
Yea I figure you had a MembershipProvider I'm just curious if you set the property ApplicationName in that provider....unless of course you're using a custom provider
As far as the permissions i'm not too sure
it seems strange that it needs write permissions for that to work....Are you using the SQLMembership or a customMembership?
do you have the authentication mode set to forms?
IS the directory propertly configured as an application with scripts access in IIS?
Or are you just using the temporary web server it creates for you?
Just some random guesses :)
jkub:What I actually needed to do was go to C:\Inetpub\wwwroot, right click on my web-site folder (which I called test_login), select the "security" tab, and set "users" to have read and write permissions.
When you debug with ASP.NET Development Server, the process account which access resource is your Windows Logon account, mostly it is local administrator. However, after publishing the project to IIS and view page through IIS, the process account is ASPNET (IIS 5.x) or NETWORK SERVICE (IIS 6.0) which has restricted permission. This may cause the issue.
Actually “user” is a group that contains several accounts. You can check which accounts it includes by Computer Management tool:
1. Open Computer Management tool from: Start | Control Panel | Administrative Tools | Computer Management
2. Expand “Local Users and Groups” node, and then click “Groups” node.
3. Double click “Users” group, then you can know which members in this group.
Instead of grant to permission to “users” group, you should grant permission to ASPNET or NETWORK SERVICE user.
Since you can grant permission to physical folder to resolve the issue, the above information is enough. If someone also encounter error message of login SQL Server failed, he must check the SQL Server login list to confirm if ASPNET or NETWORK SERVICE has already been added and granted “dbcreator” role (for attaching database). In addition, the account needs read and write permission for the attached database.
About how to create SQL Server login account, please refer to the following link:
How to: Create a SQL Server Login
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.
Thanks! I changed my permissions for my web-site in C:\Inetpub\wwwroot\TM_Website (TM_website is my website) to grant permission to the ASPNET user and removed the "Users" group and this works great. Also, previously, I meant to say that I specified an applicationName, so this part was ok.