0

I have a server with IIS 6.1 In a Windows Server 2008 which is serving an ASP web site, the page is running OK, and the javascript is being served correctly as you can see here.

But in another Windows Server 2012 with IIS 6.2 serving the same website I have this problem.

I have tried to solve with multiple solutions but nothing works. I have saved the file as ANSI, set the default Script Language to Javascript, but it does not work.

Dont understand why in 2008 server is running Ok and in the 2012 is not running OK. could be this a missing server configuration? Ideas?

Samuel
  • 1
  • 1

2 Answers2

0

To quote an answer from SO;

  1. Open the file in notepad
  2. Go to file and "save as"
  3. Right under the file name box, you will see a drop down menu for encoding. Choose ANSI.

As it's a encoding error most likely

yagmoth555
  • 16,758
  • 4
  • 29
  • 50
  • No I have tried that already, it does not work, and the weird is that the file is not a vbs. It is a Javascript file you could see that in the URL. I have tried to change default script language to Javascript on IIS and it does not work. That javascript is icluded in an asp file with the normal tags . Accessing directly I get this error, and loading the Javascript is not posible also. – Samuel Mar 14 '18 at 16:42
  • The error seem to be flagged on a ` on the line 9, but yes I agree to see the VBS compiler for .js is weird. – yagmoth555 Mar 14 '18 at 16:49
0

I solved the problem, I found that the javascript contains the following character "<%" and that correspond to open tag for ASP code. Since my web application is an ASP web page the server interpreted that as ASP code, even the file was an javascript (*.js). The way I solve this was:

1) Right click on the corresponding application pool, and select advance settings. 2) On ".NET Framework version" change it to "4.0". 3) On "Enable 32 bits" I set to "True". 4) On "Managed Pipeline mode" I set "Integrated".

Once that was done I set/change this on web.config

<handlers accessPolicy="Read, Execute, Script">
        <add name="ASP-Classic-in-js" path="*.js" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="Unspecified" requireAccess="Script" preCondition="bitness64" />
</handlers>

And after that, restart the application pool, and restart the website.

Samuel
  • 1
  • 1