Topic: Setting up web site with UltimaHosts and MyCredenza source code
Share/Save/Bookmark

Description:  This topic shows you the steps to start up a new site on Ultimahosts, the database, and the source code for MyCredenza. 


1.  Register your domain.
     - Go to your domain provider and register a domain.
     - Change the named servers to Ultimahosts servers (e.g. NS1.ULTIMAHOSTS.COM)

2.  Add the Domain
 
      - Log in to the control panel for Ultima Hosts
      - Go to the Domains section
      - Add the Domain for the one you registered in step 1

3.  Create a Web site
      -
Go to the Web Site section
      - Create a new Web site for the name you registered in step 1

4.  Add the Mail Domain
     
- Go to the Mail | Account section
      - Add a new Mail Account.  e.g. Support@MyCredenza.com
      - Do this for admin, support, etc...

5.  Add the Database
     
- Go to the Database | SQL Server 2005 section
      - Create a database (name it after your domain from step 1)
      - Select a User for your database.  If you haven't created a user account, you may need to do that first.

6.  Add advanced Web statistics
      - Go to the Advanced web statistics section
      - Add Statistics site for your domain created in step 1

7.  Run the Remote Register to create the aspnet database tables
     
 - Navigate to "C:\Windows\Microsoft.Net\Framework\v2.0.XXX"
      - Run "aspnet_regsql.exe" (The Asp.Net SQL Server Setup Wizard should launch)
          - Click "Next" next on the Welcome page
          - Select "Configure SQL Server for application services" radio button and click next
          - Enter your server Address or IP in the server textbox
          - Select "SQL Server Authentication"
          - Enter UserName and Password for your database 
          - Type in the database name (This is what you created in step 5) and Click "Next"
          - Click"Next" again on the Confirm page
          - If it successfully runs, you should have a finish page.
      - If you check your database, you should have 11 tables starting with aspnet_

8.  Populating the database with values
      - Open up SQL Server Management Studio to your database
      - Run the following scripts to populate the tables.  (Change values where needed)
      - The password is "admin123", you'll want to change after you get the site running

   INSERT INTO aspnet_Applications(ApplicationName, LoweredApplicationName, Description)
   VALUES('MyCredenza','mycredenza','Web Desktop Application')

   GO

   INSERT INTO aspnet_Roles(ApplicationID, RoleName, LoweredRoleName)
   SELECT (SELECT ApplicationID FROM aspnet_Applications WHERE ApplicationName = 'MyCredenza'), 'PowerUser', 'poweruser'
   UNION SELECT (SELECT ApplicationID FROM aspnet_Applications WHERE ApplicationName = 'MyCredenza'), 'Guests', 'Guests'
   UNION SELECT (SELECT ApplicationID FROM aspnet_Applications WHERE ApplicationName = 'MyCredenza'), 'Admins', 'admins'

   GO


   INSERT INTO aspnet_Users(ApplicationID, UserName, LoweredUserName, LastActivityDate)
   SELECT (SELECT ApplicationID FROM aspnet_Applications WHERE ApplicationName = 'MyCredenza'),'davelittleton','davelittleton',getDate()
   UNION SELECT (SELECT ApplicationID FROM aspnet_Applications WHERE ApplicationName = 'MyCredenza'),'admin','admin',getDate()


   GO

   INSERT INTO aspnet_UsersInRoles(UserID, RoleID)
   SELECT (SELECT UserID FROM aspnet_Users WHERE UserName = 'davelittleton'),
          (SELECT RoleID FROM aspnet_Roles WHERE RoleName = 'Admins')
   UNION SELECT (SELECT UserID FROM aspnet_Users WHERE UserName = 'davelittleton'),
          (SELECT RoleID FROM aspnet_Roles WHERE RoleName = 'Guests')
   UNION SELECT (SELECT UserID FROM aspnet_Users WHERE UserName = 'davelittleton'),
          (SELECT RoleID FROM aspnet_Roles WHERE RoleName = 'PowerUser')
   UNION SELECT (SELECT UserID FROM aspnet_Users WHERE UserName = 'admin'),
          (SELECT RoleID FROM aspnet_Roles WHERE RoleName = 'Admins')
   UNION SELECT (SELECT UserID FROM aspnet_Users WHERE UserName = 'admin'),
          (SELECT RoleID FROM aspnet_Roles WHERE RoleName = 'Guests')
   UNION SELECT (SELECT UserID FROM aspnet_Users WHERE UserName = 'admin'),
          (SELECT RoleID FROM aspnet_Roles WHERE RoleName = 'PowerUser')


   GO

   INSERT INTO aspnet_Membership(ApplicationID, UserID, Password, PasswordFormat, PasswordSalt,
               Email, LoweredEmail, PasswordQuestion, PasswordAnswer, IsApproved, IsLockedOut, CreateDate,
               LastLoginDate, LastPasswordChangedDate, LastLockoutDate, FailedPasswordAttemptCount,
               FailedPasswordAttemptWindowStart, FailedPasswordAnswerAttemptCount, FailedPasswordAnswerAttemptWindowStart)
   SELECT (SELECT ApplicationID FROM aspnet_Applications WHERE ApplicationName = 'MyCredenza'),
          (SELECT UserID FROM aspnet_Users WHERE UserName = 'davelittleton'),
          
'hqEYGB3CuW67flqYE8cYqg+ftH4=', 1, 'Q+dYsYTrXS88nXE3pyYrcg==', 'davelittleton@covertcoder.com'

          'davelittleton@covertcoder.com',  'Favorite Pet', 'K7A0VXieSaDhWtDazPm0X3k/Kac=', 1, 0, getDate(),
          getDate(), getDate(), '1754-01-01', 0, '1754-01-01', 0, '1754-01-01'

   UNION SELECT (SELECT ApplicationID FROM aspnet_Applications WHERE ApplicationName = 'MyCredenza'),
          (SELECT UserID FROM aspnet_Users WHERE UserName = 'admin'),
          
'hqEYGB3CuW67flqYE8cYqg+ftH4=', 1, 'Q+dYsYTrXS88nXE3pyYrcg==', 'davelittleton@covertcoder.com', 
          'davelittleton@covertcoder.com',  'Favorite Pet', 'K7A0VXieSaDhWtDazPm0X3k/Kac=', 1, 0, getDate(),
          getDate(), getDate(), '1754-01-01', 0, '1754-01-01', 0, '1754-01-01'

   GO


   INSERT INTO aspnet_Profile(UserID, PropertyNames, PropertyValuesString, PropertyValuesBinary, LastUpdatedDate)
   SELECT (SELECT UserID FROM aspnet_Users WHERE UserName = 'davelittleton'),
           'FirstName:S:0:4:MyTheme:S:4:4:LastName:S:8:9:', 'daveBluelittleton', '0x', getDate()
   UNION SELECT (SELECT UserID FROM aspnet_Users WHERE UserName = 'admin'),
           'FirstName:S:0:5:MyTheme:S:5:4:LastName:S:9:5:', 'adminBlueadmin', '0x', getDate()


   GO

9.  Setting up your Solution and Project      - Create a new folder on your computer or memory stick.  E.g. "MyCredenza"
      - Add a folder under your new folder called "Solution"
      - Open up Visual Stuio 2005, and create a solution at this location
      - Add another folder under your Root Folder (E.g. "MyCredenza") and call it "WebApp"
      - Copy all of the website files to this folder.
      - Right click on your solution within Visual Studio 2005 and click "Add Existing Web Site"

10.  Setting up your code
      
- Open up your web.config and modify your connection string to point to your database
      <connectionStrings>
         <clear/>
         <add name="MyCredenzaConnectionString"
              connectionString="server=72.52.194.183;database=MyCredenza;uid=MyLogin;pwd=MyPWD;"
              providerName="System.Data.SqlClient" />
         <add name="LocalSqlServer"
              connectionString="server=72.52.194.183;database=MyCredenza;uid=MyLogin;pwd=MyPWD;"
              providerName="System.Data.SqlClient" />
      </connectionStrings>


      
- Within your web.config, modify your membership section to point to connection string and application
      <membership>
         <providers>
            <clear/>
            <add name="AspNetSqlMembershipProvider"

                 type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                
connectionStringName="MyCredenzaConnectionString"

                 enablePasswordRetrieval="false"
                
enablePasswordReset
="true"
                
requiresQuestionAndAnswer
="true"
                
applicationName
="MyCredenza"
                
requiresUniqueEmail
="true"
                
passwordFormat
="Hashed"
                
maxInvalidPasswordAttempts
="8"
                
minRequiredPasswordLength
="6"
                
minRequiredNonalphanumericCharacters
="0"
                
passwordAttemptWindow
="10"
                
passwordStrengthRegularExpression="" />

         </providers>
       </membership>

      - Within your web.config, modify your roleManager section to point to connection string
     
<roleManager enabled="true" defaultProvider="AspNetSqlRoleProvider">
         <providers>
            <clear/>
            <add name="AspNetSqlRoleProvider"
                 connectionStringName="MyCredenzaConnectionString"
                 applicationName="MyCredenza"
                 type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f711d50a3a" />
         </providers>
      
</droleManager>

      - Within your web.config, modify your mailSettings
     
<system.net>
         <mailSettings>
            <smtp>

               <network host="mail.ultimahosts.net" userName=admin@MyCredenza.com" password="myPassword" />
            </smtp>
         </mailSettings>
      </system.net>

      - Within your "App_Code/BLL/SiteSettings.cs" class, change the siteEmailAddress in the LoadFromConfiguration method.
      - Within your "App_Data/site-config.xml" file, change the SiteEmailAddress
      - Within your code files, change the title on your pages to your web sites name

 10.  Publish your website      - Once you have made the name changes throughout your web application.  Build and then publish your application.
      - When publishing, I use the following settings:
         - Uncheck "Allow this precompiled site to be updatable"
         - Check "Usefixed naming and single page assemblies"
         - Uncheck "Enable strong naming on precompiled assemblies"
      - You can zip up your published files, upload and extract them at your website and they should be ready, as soon as your domain provider registers your nameservers.