Home > Enterprise >  Avoid index.html in Azure url
Avoid index.html in Azure url

Time:09-27

I've published on Azure a .NET Framework 4.8 web application (which front end is made in Vue.js 2). If I go to https://XXX.azurewebsites.net/ it shows an error page with the following message:

"Server Error in '/' Application. The resource cannot be found."

Instead if I add index.html in the path (https://XXX.azurewebsites.net/index.html) I can see the login page of my web app. How can I avoid to add index.html in the url?

CodePudding user response:

I found out that the problem was caused by a configuration of the mvc application. In global.asax file there is a call to a static method:

public static void RegisterRoutes(RouteCollections routes) {
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );
}

I've removed the MapRoute method call and everything has started working as expected

  • Related