LLL LLL - 5 months ago 25
ASP.NET (C#) Question

Serving a web app from a nested folder in ASP.NET as if it was root

I am working with an Angular 2 app that is being served with a simple ASP.NET WebApplication.

The whole code is bundled into 1 folder with webpack. Currently when I want to (re)deploy the ng app I have to delete old bundle and index.html files and paste in new ones, then include them in VS project and publish.

How would I go about serving all those files from a dist/ folder in my asp.net app without changing the autogenetared files?

I tried putting the folder, that includes index.html, there, and adding path to that index file in web.config, but then I also need to update the autogenerated paths to bundles on index.html, because by default it still looks at the root dir.


you may set base tag in your html.

    <base href="/dist/" >

so all the URL will be relative to that.

And you may access your application by navigating to

   <root url>/dist/index.html

Hope this helps!!