ASP.Net Training Application Setup Guide

This guide will cover the installation and configuration of the Training Web Application and the MS SQL databases that support it.

If you’re familiar with setting up web applications you can skim over most of this document and concentrate mostly on the sections for Directory Permission and Initial Application Setup.

For instructions on how the application works and detailed information on the controls please refer to the AdminGuide.doc file.

System/Database Requirements

  • IIS 6 (or greater)
  • SQL 2005 (or greater, express editions will work)
  • Windows PC Capable of running Visual Studio 2008 or greater (express editions are untested but should work other than publishing, you’re on your own there)
  • Administrative access to the directories in IIS 6 either on your own network or from a shared hosting environment the ability to set permissions on directories

Database Configuration

There are two (2) sql scripts included in the TrainingAppDeployable directory. TrainingCreate.sql and LogDBCreate.sql.

TrainingCreate.sql is the main database for the Training Application. Using SQL Management Studio, create a new database (ex. Training). Open the TrainingCreate.sql file in Management Studio and select your newly created database to run the script against. This will create all tables, stored procedures, triggers and insert the basic data for the application. After running the script, create a user that will have read/write access to all database objects.  (Refer to this link for more information on creating SQL users: http://msdn.microsoft.com/en-us/library/aa337562.aspx)

LogDBCreate.sql is the logging database which is used to store all information from the log4Net and ELMAH dlls. These are very useful for more detailed information about what’s happening when the application is running. Follow the same steps as you used to create the TrainingCreate.sql database and user login.

Configuring the Application in Visual Studio

Open the Training.sln file in the TrainingAppDeployable directory in Visual Studio 2008 (or 2010 if you have it). Do a build on the application to be sure at this point everything necessary to run the application is working. If any referenced dlls  (from the References directory in solution explorer) are missing you can find them in the references directory inside the TrainingAppDeployable. The following dlls are necessary to run the application: Elmah.dll for HTTP error trapping, log4Net.dll for logging, itextsharp.dll and TSHAK.Components.dll for creation of the Training Certificates.

After making sure all references are correct and the build is successful it’s time to edit the web.config file in our web application to work with our databases and dlls. Simply open the web_config.doc file in the TrainingAppDeployable directory and alter the web.config supplying the necessary information as indicated.

If, after modifying the web.config, your application successfully builds it is then time to setup IIS for hosting the application.

Configuring IIS and directories

I will cover how to set this up as if you had full administrative access to the web server and IIS on your machine or your network. If you plan to run this in a shared hosting environment you’ll need to pay attention to the directory security section for allowing read/write access to the correct directories for the uploading of files.

On the web server you intend to host your application, create a directory somewhere, typically this in the C:\Inetpub directory. Open IIS and right click on Web Sites and select NEW -> WEB SITE. Follow the creation wizard steps and choose a Description for your site and click NEXT. On the IP Address and Port Settings you can choose to use ALL UNASSIGNED for IP address of if you have access to a static IP for this application assign it here, port 80 is the standard web port, default host head can be left blank (we will revisit host headers below), click NEXT. On the Web Site Home Directory settings, click the BROWSE button and navigate to the directory you created for your application (ex. C:\Inetput\TrainingApp) and check Allow anonymous access to this website if you intend for this site to be accessed by the public, then click NEXT. On the Web Site Access Permissions make sure READ and RUN SCRIPTS (Such as ASP) are both checked, then click NEXT. Click the FINISH button to complete the wizard step.

It is always a good idea to create a separate Application Pool for each web application to isolate it and keep it from affecting the other sites on your server. This is not mandatory, but if you would like to, right-click Application Pools, select NEW -> APPLICATION POOL, give your Application Pool a new ID (such as Training) and leave the default radio button selected for Use default settings, then click OK. To assign this Application Pool to our web application, right-click your web application under Web Sites and select Properties. Select the Home Directory tab and then use the pull down for Application Pool to select the Application Pool you just created and click APPLY.

Web Application Properties

If you closed the Properties window for the web application after assigning the Application Pool, re-open it.

If you’re hosting this application on server with multiple sites but only one external IP address you’ll want to configure your host headers to allow access to your application (this also requires being able to set host entries for your DNS server which I will not cover here.). Click the Web Site tab, then, next to the IP Address field click the Advanced button. Click on the entry in the Advanced Web Site Identification window for the top box, which handles unsecure web traffic, click EDIT and put a value for Host Header Value, something like YOURAPPNAME.YOURDOMAIN.COM or just YOURDOMAIN.COM if you have a domain specifically for your application. Don’t forget to add a second entry (using the ADD button) for www.YOURDOMAIN.COM if you do have a specific domain. Click OK, then on the Properties page, click APPLY, but do NOT close the window yet (you’d do this clicking OK).

Next, click the ASP.Net tab and make sure you set the version to 2.0.50727 (this is the version for 2.0. 3.0 and 3.5 which all use the 2.0 framework). If you don’t have this version available, download and install it. Click APPLY, but do not close the Properties window.

Next, click on the Documents tab and if an entry does not exist for content page that days Default.aspx, the click the Add button, add the entry, click OK, then select the entry and move it to the top position by clicking Move Up.

Next, click the Directory Security tab and under Authentication and access control click the EDIT button. Make sure Enable Anonymous Access is checked if you want this application open to the public, this is the ONLY box you need checked. Otherwise, you can check Integrated Windows authentication if this will be accessed on your Intranet. Click OK on this window.

Your settings should now be complete; you can click the OK button in the main Properties window and save your configuration changes.

Directory permissions

In order for the web application to function as designed certain directories required opening up some permissions for the account the web application runs under.

In IIS expand your web application so you can see all the directories. Right click and give read/write permissions to the user that your application runs under or you can choose to add “Everyone” as an account and give read write permission to the following directories:

  • Certs
  • Video
  • Images/quizzes/full
  • Images/quizzes/thumb
  • Images/logos

Publishing the Application

Now that all is ready in IIS, you can publish the application. There are various ways to accomplish this, but my preferred method is to map a network drive to the directory on the web server and then just right-click the project in Visual Studio, select Publish and point at the virtual drive for the destination. If your site is hosted on a remote location you can also select to use FTP when you select Publish.

Initial Application Setup

After publishing you’ll need to get a few things set up in the application itself, one of which is your superadmin account. There is also an admin account, I’ll explain the difference. The admin role is one you can configure for someone else to get in and use the application controls but the admin roles does NOT have access to the .Net membership controls for making changes to user account settings, the superadmin DOES have that ability.

In Visual Studio you will see an icon in the top right of your Solution Explorer that is a small red hammer over a globe (Fig 1). Click this to bring up the ASP.Net Configuration tool.

Fig 1

The ASP.Net Configuration tool (Fig 2) allows you to add/edit/delete user accounts and roles as well as other application settings. The only settings you’ll need to worry about is creating you superadmin user account. The roles have already been added when you ran the SQL scripts as well as the application name.

Fig 2

Click the Security link button, you’ll notice there are 0 users at this point. You’ll then be able to add a new account and assign it to the superadmin role as seen in Fig 3.

Fig 3

Fill out the Create User form, select the superadmin role from the group of Roles to the right, and click the Create User button. You now have the superadmin account created and can login to the application and complete the setup.

Configuring the application in the Admin section

Now that you have a superadmin account you can login to the application’s Admin Controls and finalize the rest of the application for use.

Navigate to your application wherever your installed it (ex. http://training.mydomain.com, http://mydomain.com, http://mydomain.com/training) and you will be directed to the Login page (Fig 4).  You do no need to specify that you wish to login to the admin area, redirection is handled by role. Admins and SuperAdmins are directed by default to the Admin Controls.

Fig 4

Once logged in as superadmin you will see all the Admin Controls available (Fig 5). There is a default quiz, sample collateral material and module that was configured when the SQL scripts were run. This will allow you to test the application and understand what’s necessary for setting up future Quizzes, Modules, etc.

Fig 5

Click on the Add Group control to create your first group. You will be directed to the Add Group form (Fig 6).  All fields on this form are mandatory with the exception of Group Logo. Group Name is what the users see on the Training Application for the name of the group they are associated with. Login Name is the generic login account given to users of the group to login the first time and then create THEIR OWN personal account which will be associated with the group.

Fig 6

At this point configuration is done. The application is ready to use. For more detailed instructions on the Application and Admin controls, please refer to the AdminGuide.doc

 

Last edited Dec 28, 2011 at 4:19 PM by brhody, version 6

Comments

No comments yet.