locked
Setting a Web Root Folder RRS feed

  • Question

  • User1899107686 posted

    Hi All,

    I'm not sure if this is the right forum but it seems like a "Getting Started" question.

    I have an ASP.NET web app project in Visual Studio 2015, using IIS Express. The simplified folder structure of the project looks like this:

    ProjectName
       |
       |
       +--privateFolder
       |
       |
       +--publicFolder
                 |
                 |
                 + -- default.htm

    Basically, I want the "publicFolder" to be the root of my web application. All resources served by the application are in publicFolder. I have been partially successful at making this happen by editing the applicationhost.config file so that it has this virtualDirectory entry (note the "\public" at the end):

    <virtualDirectory path="/" physicalPath="C:\Users\blahBlah\Desktop\Dev\Sites\Web Sites\ProjectName\public" />

    With the above entry in applicationhost.config, the "public" folder is the root of my web application and I am able to browse to a URL like http://localhost:3487 and it works. Note that I do not have to put "/public" in the URL because it is mapped to in the virtualDirectory entry shown above. This is my goal, to not have "/public" in the URL but yet to maintain the directory structure I showed above.

    Here's the problem though: When I close and then re-start Visual Studio, it re-writes the virtualDirectory entry above, removing the trailing "\public".

    Is there a way to tell VS that I want a particular sub-folder in the project to serve as the root?

    Wednesday, August 19, 2015 4:54 PM

Answers

  • User-166373564 posted

    Hi,

    Is there a way to tell VS that I want a particular sub-folder in the project to serve as the root?

    From your description above,  I think you can use Override application root URL, it specifies an alternative path for the application root URL. Use this option if the Web application root is not the root of your project.

    At the same time I'd also like to suggest you to consult IIS experts in URL Rewrite Module forum, IIS experts can give you more precise answer.

    Please let me know if you need any help.

    With regards,

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 24, 2015 4:20 AM