Javascript Not being served Properly ASP IISRSS

6 replies

Last post Jun 01, 2018 11:26 AM by grz3sio

  • Javascript Not being served Properly ASP IIS

    Mar 12, 2018 07:26 PM|ssssaaamm|LINK

    Hello, I have a Windows Server 2008 with IIS 6.1 serving an ASP website. The page is working correctly and the javascript are being served correctly:

    https://casper09.zip2tax.com/website/pagescountries/canada/index/canadamap.js

    But in a Windows Server 2012 with IIS 6.2 the javascript are not being served correctly:
    https://frank02.zip2tax.com/website/pagescountries/canada/index/canadamap.js

    Please can someone help me, I have tried multiple solutions. Saving the js as ANSI. configuring the default Script language in IIS to JScript but it does not work. 

  • Re: Javascript Not being served Properly ASP IIS

    Mar 13, 2018 06:07 AM|Yuk Ding|LINK

    Hi ssssaaamm,

    Did you change something for the .js file and what do you mean the javascript is not being served correctly? I just notice that your https://frank02.zip2tax.com/website/pagescountries/canada/index/canadamap.js is recognizing the .js file as text/html type while the other one return application/x-javascript. So did you install the static content from turn windows features on or off->internet information service->world wide web service->common http feature->static content. Please ensure the .js file is set to the right content type.

    In addition, if you have enabled the compression, you could try to disable it.

    Best Regards,

    Yuk Ding

    Yuk Ding

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.
  • Re: Javascript Not being served Properly ASP IIS

    Mar 14, 2018 05:25 PM|ssssaaamm|LINK

    No Yuk, I did not change nothing in the .js file, yes the javascript is on frank02 server is showing an 500 server error, and I dont know why, that is only for that javascript, all the others javascripts works well. The javascript file is the same that is on casper09, and casper09 is showing a 200 response. Both servers has mime type in global server configured like this:

    Extesion: .js
    MIME type: application/x-javascript

    Entry type: local

    I can see that inside the Internet Information Manager> click on my server> MIME Types.

    I have disable compression as you suggest. But I get the same problem.  And yes I have installed static content feature. I dont know why in the casper09 is working well (with 200 response) , but in frank02 get 500 error.

  • Re: Javascript Not being served Properly ASP IIS

    Mar 20, 2018 09:00 AM|Yuk Ding|LINK

    Hi ssssaamm,

    If this issue only occur on the specific javascript file. Have you tried to define the javascript  encoding.

    Best Regards,

    Yuk Ding

    Yuk Ding

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.
  • Re: Javascript Not being served Properly ASP IIS

    Mar 21, 2018 02:45 PM|davewj2o|LINK

    The same file worked on 4 of our servers yet did not work on 2 of them.

    We found that inside the javascript were the characters <%.  I think IIS was trying in interpret it as vbScript.

    Apparently Microsoft already had a fix for this which we implemented and we're all good now.

  • Re: Javascript Not being served Properly ASP IIS

    May 29, 2018 10:58 AM|grz3sio|LINK

    I have similar issue and I am tried to find what is about but it is hard :/.

    I think it might be connected with Content type, but I do not know how to make iis to send application/javascript not text/html.

    I set Mime types to Extension: .js, Mime Type: application/javascript

    Does anyone know hoe I should configure IIS or what I could change?

    In Windows Server 2008 R2 with IIS 7.5 works fine.  Request is as follows:

    Request URL: http://YYY.dk/dist/scripts/master.min.js?v=636626751348856953
    Request Method: GET
    Status Code: 200 OK
    Remote Address: 127.0.0.1:80
    Referrer Policy: no-referrer-when-downgrade
    Accept-Ranges: bytes
    Cache-Control: max-age=604800
    Content-Length: 615852
    Content-Type: application/x-javascript
    Date: Mon, 28 May 2018 14:20:11 GMT
    ETag: "798a96280f2d31:0"
    Last-Modified: Wed, 23 May 2018 10:25:34 GMT
    Accept: */*
    Accept-Encoding: gzip, deflate
    Accept-Language: en-US,en;q=0.9
    Cache-Control: no-cache
    Connection: keep-alive
    Cookie: YYYcookieAccept=accepted; __utmz=258865941.1524561636.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmc=258865941; YYYselectedContracts=0000-2002-2003; __RequestVerificationToken=UqdXQ1_ejhP5-kgGDAaX60_-oYk6eHGZ0uvQCSCPHU6eynjO4rLMiHW2DzuxIibBSojbAXLQlXTuUP1BrMs64xNiwcM1; basketGuid=a464412e-f75c-4d01-a41a-b9884f9d95b5; YYYbasket=%7B%22total%22%3A0%2C%22totalIncludingVat%22%3A0%2C%22totalQuantity%22%3A0%7D; YYYident=P6jcxvMxCFp6PkERgoj2oJMWS2phRplZ-Cu81o9Ii_pb4qd45crpAD44jMAh5hz1oIoAWFWgjbuqxla23L7l8-VdR7yp1pdMsdZingh8lQF57zxIGjEY_98C-Z0uOdJmGb4ha_kuEvOtN-EKCL4PzXxBcVTQMMqhztFF2V6R7vYgL-_WwmC1rYJhOBHCm5d_xe5B0FFCRZ7OMAbyG_CyzlLnbpcLoLBRuZUV3kJPg3RIdIxQqrR3-ZWELzaqHxuO4EAn_it9KDLdpvmDyMOeKyrzjpbFDGr8OOYlxDUIDXwqJ-UBrHWm4YZOsm-XIjoi_PkQV6q3oTEdb_K-DqoEdz1KjDT5dXy-LJjymtuRwJvO36xf3XFK4ysSYYYIs-fjdEiyMxDYdDgKRK5dkshxkx_MdrwzKFYm12mylsydGanubhtH8ZbqE8nTDnWZ9dWXETklzVHXxxA21PF-4qp5603GvRguKwsEezuc2HkDFnzjXTIE_PauCI3NhDg5PGD4tSZ2AuN49d0T0rb3AYVDrA5vu-mZkGiMrt00pdWmOx2cXbMeRmxdsHYDIxBhDG8_HZjR9zS3t4SieyCc50UW0qRWF5MsQ1PmXOmL1tXqlpgCoFl3qQ2-K6C3eYqvFANXrdVA83ggTMb_iFHkXn8kymJl3mbB-z_O_WCVkDXYAQZKUVdzrY5EGHHHg6C8a5EVN80AiiLPqn5XBc0qvSI6a0lAiUvy9BMm9p7Jjy9OAbvMwmRUepIoWmVpOpCn3cY8W38pFOTbwuUQpFdo8Jh2s5b_DFNrECB38Fvtb9AWQ7EccQ2TiYh749oSiWYHucUWo7m2NA; __utma=258865941.517767616.1524561636.1527509850.1527517186.41; __utmt=1; __utmb=258865941.1.10.1527517186
    Host: YYY.dk
    Pragma: no-cache
    Referer: http://YYY.dk/
    User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36
    v: 636626751348856953

    In Windows 8 with IIS 8.5 it doesn't work correctly.  Request is as follows:

    Request URL: http://YYY.dk/?ReturnUrl=%2Fdist%2Fscripts%2Fmaster.min.js%3Fv%3D636631873613634548
    Request Method: GET
    Status Code: 200 OK
    Remote Address: 127.0.0.1:80
    Referrer Policy: no-referrer-when-downgrade
    Cache-Control: no-cache
    Content-Encoding: gzip
    Content-Length: 13013
    Content-Type: text/html; charset=utf-8
    Date: Tue, 29 May 2018 09:22:01 GMT
    Expires: -1
    Pragma: no-cache
    Vary: Accept-Encoding
    X-AspNetMvc-Version: 5.2
    X-MiniProfiler-Ids: ["a39e0898-b645-45f2-8937-7776d6fe3bc7","bf06dfd3-b5ff-48fb-a54f-90ec2912126a","83dd0083-6913-4037-a616-0c16e12c32a2","15d6b0f2-c973-43a6-a69e-a238d0549608","26515a42-d729-4b96-89e0-cf0557faf5de","0985595b-789b-49cf-bc47-02eabddfa8a3","ed85c4ec-d842-46cd-bc4b-24ed9171a7c9","a42c2f31-3ac7-43c6-8cbb-b18c5b92a3a4","4c4e4356-d22b-4bf1-8287-6f84da3d4441","12b33a7d-3f50-4364-b644-ccdbee27e6a9","aa824385-33d9-4de3-9753-1524f93e568a","039e5172-dd2c-4eeb-a55c-546a346d39cb","f70988ae-7756-4e2e-8803-a93d4a89197a","97bce948-8679-4d9a-b312-430ea42f1de5","8a2ef233-304d-4046-990a-5e3b8ff96025","fff51193-c227-4208-8cee-d8f8ae5816ff","d45168fc-6558-42a1-8645-5ba8d3f4edb3","b68d8a8e-504e-425c-96ff-df5cb09bd302"]
    X-Powered-By: ASP.NET
    Accept: */*
    Accept-Encoding: gzip, deflate
    Accept-Language: en-US,en;q=0.9
    Cache-Control: no-cache
    Connection: keep-alive
    Host: YYY.dk
    Pragma: no-cache
    Referer: http://YYY.dk/
    User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36
    ReturnUrl: /dist/scripts/master.min.js?v=636631873613634548

  • Re: Javascript Not being served Properly ASP IIS

    Jun 01, 2018 11:26 AM|grz3sio|LINK

    Finally I had to set Application Pool Identity for this site in IIS and js works fine.

    IIS -> site -> Authentication-> Anonymous Authentication (Edit)-> Application Pool Identity (instead of Specific User IUSR)