Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run an ASP.NET website in a subfolder

Is there a way of running an ASP.NET website in a subfolder of the website?

As an example, say I wanted to run the screwturn wiki (http://www.screwturn.eu/) in a folder called "wiki" on my website, can I alter the web.config of the screwturn website to tell it that it is running in the "wiki" folder? (like saying that "~/" = "/wiki/")

The wiki would then find its assemblies that are in "~/bin" in "/wiki/bin" and the same for all other folders below the new root.

like image 642
Bernhard Hofmann Avatar asked Oct 04 '09 09:10

Bernhard Hofmann


3 Answers

Piece of cake, you can either add a virtual directory to the root of the IIS website and point it at the path of your site or place it an a physical directory in the website root then turn it into an application by right-clicking on it in the IIS management console, going to properties and clicking "Create" next to application name.

like image 70
Troy Hunt Avatar answered Nov 08 '22 03:11

Troy Hunt


You need to stop the configuration inheritance in the root web.config file so that the wiki web.config doesn't read anything from the root web.config.

like image 39
Tony_Henrich Avatar answered Nov 08 '22 05:11

Tony_Henrich


As others pointed out. basically you need to put this in your child application Web.config, of course you also need to configure the domain (sub domain etc.), IIS setting as well.

<configuration>    
  <location path="." inheritInChildApplications="false">

    //your code here

    <system.web>
      //your code here
    </system.web>

    //your code here

  </location>     
</configuration>
like image 5
Ronaldinho Learn Coding Avatar answered Nov 08 '22 03:11

Ronaldinho Learn Coding