Click here to Skip to main content
14,835,707 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Actually I am trying to use dll file in my javascript code on view page in visual studio 2019 after debug the code it shows me a resource inaccessible due to its protection level. If I am using this dll in controller it is not showing me any error like this.


Note: All Class in my dll are public static.

What I have tried:

Dll is working perfectly in controller but i when i use dll in my view page in javascript code it's show me an error resource inaccessible due to its protection level.
If anyone have an solution about it please tell me.

example of my code is:

@using UnitConversion; 

var a = @Converter.UnitConverter("mm","mil");
            console.log("unitconverter value" + a);
Posted
Updated 2-Feb-21 23:32pm

1 solution

On the Client side that will be difficult/impossible unless you are prepared to use something like Blazor:
Call .NET methods from JavaScript functions in ASP.NET Core Blazor | Microsoft Docs[^]
   
Comments
Richard Deeming 3-Feb-21 5:58am
   
I don't think the OP is trying to call the assembly from Javascript. I think they're trying to call it from the Razor view, and insert the results into a <script> tag.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900