`? Why Microsoft.JScript does it work in the code behind, but not inside <% ...">

Why does "Microsoft.JScript" work behind, but not inside `<%%>`?

Why Microsoft.JScript

does it work in the code behind, but not inside <% %>

?

I keep getting “CS0234: Type or namespace name“ JScript ”does not exist in namespace“ Microsoft ”(are you missing an assembly reference?)” Error, but it doesn't make any sense. I can add a link to Microsoft.JScript.dll

and in the code behind it works, it just doesn't work when I try to link to a thing in the web.config file or on the page itself via the following code:

<%@ Import Namespace="Microsoft.JScript" %>

Web.Config

<pages>
    <namespaces>
        <add namespace="Microsoft.JScript" />
    </namespaces>
</pages>

      

The error I keep getting is this:

Compiler Error Message: CS0234: The type or namespace name 'JScript' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

      

+2


source share


2 answers


You need to import the assembly, not just the namespace. eg.



<%@ Assembly name="Microsoft.JScript, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" %>

      

+3


source


You need to include the namespace Microsoft.JScript

at the top of the ASPX page, for example:

<%@ Import Namespace="Microsoft.JScript" %>

      



You can also enable it globally in Web.config:

<pages>
    <namespaces>
        <add namespace="Microsoft.JScript" />
    </namespaces>
</pages>

      

+3


source







All Articles