Vuetify 2 and Vue-Router with ASP.NET Core MVC

32 views Asked by At

I have been building out a vuetify 2 application with the vue cdn inside a ASP.NET Core MVC application. It has worked well and havent had to many issues with this approach and using the cdn hosted locally and my users have been happy. However, I recently decided to change my vue-router mode to 'history' and I am having the dreaded issue where if you go to the url directly in the browser it fails and cannot find that url. Its as if its not using the vue-router . So one proposed solution on here was to add the following fallback route in the router setup:

        const router = new VueRouter({
        mode: 'history',
        routes, // short for `routes: routes`
        navigationFallback: {
            "rewrite": "/index.html",
            "exclude": ["/images/*.{png,jpg,gif}", "/css/*"]
        }
    })

Unfortunately this does not do the trick for my case. Is this something to do with the fact I have my application living inside a single index file of my asp.net core application and I need to actually manage this fallback on my asp.net core side? I am struggling on this one as its unclear why the previous mode worked which uses the # and I could directly go to those URL links without messing with my asp.net core setup. This is what makes me think it can be fixed on the vue side.

0

There are 0 answers