0

I have an ASP.NET MVC application (on .NET 4.8). Currently, the DevOps team has set up Nginx to handle requests with: location: / and this works fine.

Now they want to change the setup so the application should work under: location: /report and they have done their work and waiting for my changes.

What changes do I need to make in the ASP.NET MVC project (or configuration) so that it works correctly when served from /report instead of the root (/)?

Do I need to update RouteConfig, WebApiConfig, web.config or something else?

It seems in .NET Core, we just have to set app.UsePathBase("/report"); or in Angular one of the ways is build with --base-href="/report"

1
  • If Nginx rewrites report to the app root, no changes in RouteConfig or Web.config are needed, just ensure links, scripts, and CSS use ~ or Url.Action so URLs resolve correctly. But If it doesn't rewrite, prefix your routes in RouteConfig with report/ and make sure all URLs and assets include the /report path (or use Url.Content("~/") / Url.Action(...)). Optionally you can also setset <base href="~/..."> in _Layout.cshtml. Commented Sep 24 at 7:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.