Identity Server 4 ASP.NET Core 3.1 MVC unable to render JavaScript

46 views Asked by At

I have an Identity Server 4 with an ASP.NET Core 3.1 MVC project and would like to add an external script into the _Layout.cshtml file. The JS file is being ran, however it is not working as expected. I believe this has to do with Identity Server 4 unable to parse the function or I am missing an ASP.NET Core MVC package.

Markup is supposed to be injected into the widget div via main.js script.

<body>
    <div id="widget"></div>
    <script src="~/js/[email protected]()"></script>
    @RenderSection("Scripts", required: false)
</body>

Note: The script works fine if I pull down this project https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/start-mvc?view=aspnetcore-8.0&tabs=visual-studio-code and insert the script into this _Layout.cshtml, I am able to see that it is working as expected.

The main difference being in .csproj - <TargetFramework>net6.0</TargetFramework> vs <TargetFramework>netcoreapp3.1</TargetFramework>

But I don't know if that matters. Please let me know if you need additional information.

0

There are 0 answers