ASP.NET and Godaddy, part 2

Wednesday, 02 April 2008
  • By
  • Jeff Ammons
  • Tags:
  • ASP.Net
  • Programming
  • Tips
  • Tools
  • Visual Studio
  • Web
  • Windows

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:

  1. Create local SQL Server database (Express will do)
  2. Dig through C:WINDOWSMicrosoft.NETFrameworkv2.0.50727 and run aspnet_regsql.exe. This will create all the aspnet tables, views, and stored procedures.
  3. Fire up Visual Studio 2008 and create a web site.
  4. Go to menubar: Website: ASP.NET Configuration. This will start a local web server and spawn a web page in the browser.
  5. Modify web.config and put the connection string for the database you created in the connectionStrings section for the name "LocalSqlServer".
  6. Close the web project and then reopen it. I didn't verify that this is a required step, but I did it anyway...
  7. Re-launch the ASP.Net Configuation like you did in step 4.
  8. Enable Roles management.
  9. Create a few roles. I made admin and user.
  10. Create a user.
  11. Go back to Visual Studio and add your database under the Server Explorer tab.
  12. Check the aspnet_Users table to be sure your user showed up.
  13. Right click on the database and pick Publish To Provider.
  14. 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.
  15. Log in to your account and create a SQL Server 2005 database.
  16. Make sure you select to Create ASP Schema for the database.
  17. Log in to your new database.
  18. 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!
  19. Use Godaddy's File Manager to create a new directory and upload your app to it.
  20. 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.
  21. Use their IIS Settings tool to create a new virtual directory/app. Be sure to select Set Application Root.
  22. 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.
  23. Create a Register.aspx page.
  24. Add a CreateUserWizard from the Login section of the tool box.
  25. In properties, set the ContinueDestinationPageURL to the "~/Default.aspx".
  26. Add a LoginView control to the Default.aspx page. In the Logged In Template, write something like "You are logged in".
  27. In the Anonymous Template add a Login control.
  28. Set the Login control's DestinationURL to "~/Default.aspx" .
  29. Set the Login control's CreateUserURL to "~/Register.aspx" or whatever you named that page.
  30. Test things locally to make sure they work.
  31. Upload to Godaddy everything.
  32. 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.