user5080246
user5080246

Reputation: 193

Is there a way to tell ASP.NET app where to look for a static main html

I have an ASP.NET WebAPI project and I have an AngularJS front-end in the same project. Right now, I have Index.html in the root of the project, and it works fine: when I enter something like localhost:8080, I can see the contents of my Index.html. However, I'd like to move it to an other folder, out of the root folder. Is there a way to config the application to look for a static startup Html file in a specific location? I'd like to avoid using MVC controllers just to point to the right file (I'd like to keep them out of my app).

I don't have any configuration for MVC in my Global.asax (that is no MVC RouteConfig) because I don't want to use MVC in my application because that's to be taken care of by Angular. Angular gets loaded from my Index.html. I just want to move my Index.html to Angular folder to keep it all in one place. I am pretty sure there was a way to configure that stuff in web.config in the WebForms days, but I don't remember anything about that.

Upvotes: 0

Views: 44

Answers (1)

user5080246
user5080246

Reputation: 193

I found the answer to my question. Web.config needs this:

<system.webServer>
    <defaultDocument enabled="true">
      <files>
        <clear/>
        <add value="SomeDir/SomeHtml.html"/>
      </files>
    </defaultDocument>
...

Upvotes: 1

Related Questions