Using Browserify w Asp.Net Core 2.1 React SPA


#1

I have a Visual Studio 2017 Asp.Net Core 2.1 React SPA. Just moved to Asp.Net Core 2.1 from 2.0, which uses a completely different project structure. My app includes OIDC authentication and I have a 2nd page in my SPA that handles the redirect after the user logs in.

The problem I’m having with the Core 2.1 vers of my redirect page is that instead of returning public/bundle.js in the script tag, the tag is returning what appears to be the index page of my SPA. Here’s the page:

SignedIn.cshmtl:

@page
<script type="text/javascript" src="~/public/bundle.js"></script>
<script>
    var Oidc = require('oidc-client');

    new Oidc.UserManager().signinRedirectCallback().then(function () {
        window.location = "/";
    }).catch(function (e) {
        console.error(e);
    });
</script>

.NET Foundation Website | Blog | Projects | Code of Conduct