Configuring the root folder in an ASP.NET web application

I have an ASP.NET web application project in Visual Studio 2015 using IIS Express. The simplified folder structure of the project is as follows:

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

Basically, I want "publicFolder" to be the root of my web application. I partially did this successfully by editing the applicationhost.config file so that it has this 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 can view the url like http: // localhost: 3487 and it serves Default.htm as I want. Note that I do not need to put "/ public" in the url because it appears in the virtualDirectory entry shown above.

My goal then is to not have " / public " in the URL, but still maintain the directory structure shown above.

Here's the problem: if I close and then restart Visual Studio, it will overwrite the virtualDirectory entry above, removing the final " \ public ".

Is there any way to tell VS that I want a specific subfolder in a project to always serve as the root of the application?

+4
source share

All Articles