UHCL Banner

.NET Guide for Course Hosting

Important information about web.config

Your website is an IIS application. When your application is loaded because of a request to an ASP.NET page, IIS looks into the root folder of your web site (\pages\) for a web.config file. If it does not find one, it may produce an error message.

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

You have a web.config file in a subdirectory of your application with settings that should only be in the root of your application (...\pages\web.config). If you are hosting an ASP.NET application in a subdirectory, you need to move it to the root of your application. If your web.config is in a subdirectory which is part of the application in your root directory, delete the lines from the web.config in your subdirectory.


Publishing your application

  1. Select publish from the Visual Studio toolbar and select new.
  2. Give your publish settings a name.
  3. Select FTP for the publish method.
  4. Enter your FTP address and add /pages/ to the end.
  5. Enter your username and password.
  6. Click publish.
  7. From now on, you just need to select the publish profile you created and hit the publish button.

My ASP.NET application has an error, but I can't see what it is.

Change your web.config file to include the following elements. If one of the elements exists already, change it to the values here.

<configuration>
  <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true"/>
  </system.web>
</configuration>

My ASP.NET application is showing detailed errors, but I don't want it to.

Change your web.config file to include the following elements. If one of the elements exists already, change it to the values here.

<configuration>
  <system.web>
    <customErrors mode="On"/>
  </system.web>
</configuration>


My ASP.NET application does not work on the server when created in Visual Studio 2010 (.NET 4.0 framework). What is wrong?

Web sites created on the DCM server for course hosting Spring 2012 or later have .NET 4.0 enabled by default. Personal web sites and course web sites created before spring 2012 will need to contact an RA to have the .NET level raised on their website.

My ASP.NET application works at home on my local machine, but not on the server. What is wrong?

There are a number of things that could be different between your configuration and the configuration on the server. For one, make sure you are basing your program on the .NET Framework 2.0 or higher and not the 1.1. If your project uses a file system database or uploads files, read this page. Second make sure you are not using any local paths or includes in your code. Lastly, Google the error you are receiving to see if anyone else is experiencing the problem.