Well that worked.
I dropped back to a blank sheet and worked my way up one step at a time. Only way to eliminate variables that could be causing problems.
Here are the step by step directions to get to a bare page with functional login and registration pages:
- Create local SQL Server database (Express will do)
- Dig through C:WINDOWSMicrosoft.NETFrameworkv2.0.50727 and run aspnet_regsql.exe. This will create all the aspnet tables, views, and stored procedures.
- Fire up Visual Studio 2008 and create a web site.
- Go to menubar: Website: ASP.NET Configuration. This will start a local web server and spawn a web page in the browser.
- Modify web.config and put the connection string for the database you created in the connectionStrings section for the name “LocalSqlServer”.
- Close the web project and then reopen it. I didn’t verify that this is a required step, but I did it anyway…
- Re-launch the ASP.Net Configuation like you did in step 4.
- Enable Roles management.
- Create a few roles. I made admin and user.
- Create a user.
- Go back to Visual Studio and add your database under the Server Explorer tab.
- Check the aspnet_Users table to be sure your user showed up.
- Right click on the database and pick Publish To Provider.
- Only export the table data.
Now we get to the GoDaddy portion of the operation. These steps will require some patience since you have to wait for them complete each step.
- Log in to your account and create a SQL Server 2005 database.
- Make sure you select to Create ASP Schema for the database.
- Log in to your new database.
- Use Query Analyzer to run the file you created back in step 13: Publish To Provider. This will ERASE any existing table data, so use caution on your SECOND AND SUBSEQUENT webapp! For those you will want to only append data, not delete first. You have been warned!
- Use Godaddy’s File Manager to create a new directory and upload your app to it.
- Using their File Manager’s Edit utility, modify your web.config so that the connection string points to the database you created there, not your local database.
- Use their IIS Settings tool to create a new virtual directory/app. Be sure to select Set Application Root.
- You should now be able to hit your page.
That was the hard part. Now for the easier stuff.
I’m not going to include these in the step by step instructions, just summarize them.
- Create a Register.aspx page.
- Add a CreateUserWizard from the Login section of the tool box.
- In properties, set the ContinueDestinationPageURL to the “~/Default.aspx”.
- Add a LoginView control to the Default.aspx page. In the Logged In Template, write something like “You are logged in”.
- In the Anonymous Template add a Login control.
- Set the Login control’s DestinationURL to “~/Default.aspx” .
- Set the Login control’s CreateUserURL to “~/Register.aspx” or whatever you named that page.
- Test things locally to make sure they work.
- Upload to Godaddy everything.
- Make sure you change the connection string in the web.config file like you did in step 20.
At this point it works for me. I can add users and log in.
The key here is to step back, simplify what you are trying to do and build up one step at a time.
In Agile programming you try to break things into chunks that can be delivered early. In this case I tried to do too much with my first attempt. It didn’t seem like much until something broke. Now that I have gone back and started much smaller, I have a working system that can register and authenticate users instead of a bigger system that can’t do anything…
More details later.