How do I set up an IIS website that uses a subfolder of a .NET web application as its base?

asp.net, c#, iis-6, virtual-directory, visual-studio-2010

Solution

- Go to the IIS.

- Right Click your WebSite.

- Create the Virtual Directory with the name of mysite1.

- Right click the Virtual Directory mysite1 and select Convert to Application

Now you can operate `http://mysite1/` and pages inside `mysite1`

CodeBehind = Needs to be compiled ( asp.net 1.1 model) and compiled binary is placed in the bin folder of the website. You need to do a compile in visual studio before you deploy. Good model when you do not want the source code to be viewable as plain text ... for example when delivering to a customer who you not have obligation to provide code.

CodeFile = You provide the source file with the solution for deployment. ASP.NET 2.0 runtime compiles the code when needed. The compiled files are at Microsfot.NET[.NET version]\Temporary ASP.NET Files.

Problem

I have a .NET web application in which I am developing three separate websites that all share some classes, master pages, etc. (Call the sites `mysite1`, `mysite2`, and `mysite3`) When I view the site using "View in Browser" from VS (which leads to http://localhost/projectName/mysite1/default.aspx), everything works as expected. However, I also setup an IIS website called `Mysite1` that uses http://mysite1/ and points to the "mysite1" subfolder as its local path (under Home Directory). When I visit http://mysite1/, I get the following ASP.NET error: Parser Error Message: Could not load type 'MyProject.Mysite1.Default'. Source Error: `Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MyProject.Mysite1.Default" %>` `Line 2:` `Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">` The namespaces are all valid, as evidenced by the site working correctly when run from "View in Browser". I figure it has something to do with the base folder of the application artificially changing because that's what several other errors were caused by, but I don't know how to resolve it. How should I have configured IIS to use the subfolder of a web application as its base folder?

Original source

Related problems