Search code examples
c#asp.netsqlajaxwebmethod

C# ASPX Errors - "'Sys' Is Not Defined" - Caused by "GET https://domain/ScriptResource.axd? 404 (Not Found)"


I have a asp:ScriptManager loading a javascript file which handles some WebMethods so I can dynamically update data in my website. The site works locally for me but when I put it on a different server, it loads with the error in the title and the JS doesn't work. This is the final line in my javascript which returns the errors:

if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();

This appears to be a pretty wide spread error with what seems like a million solutions, none that have seemed to work thus far for me.

I have a feeling that it's not loading the AJAX files properly or at all.

One trick I was reading about was to locally include the 2 AJAX .dll files (System.Web.Extensions.dll & System.Web.Extensions.Design.dll) in a bin folder but I don't know how to include these in the web.config or Default.aspx files rather than whatever it is trying to access and failing.

Does anyone have a fix to this that doesn't include editing the properties of the IIS site as I don't have access to do so?

Below is my Script Manager reference at the bottom of my page:

<asp:ScriptManager runat="server" 
  id="ScriptManager1"
  EnablePageMethods="true">
    <scripts>
      <asp:ScriptReference Path="js/scripts.js"></asp:ScriptReference>
    </scripts>
</asp:ScriptManager>

Thankyou in advance, Matt.

Edit: added ScriptManager reference


Solution

  • I found the solution to this problem that putting the entire site in the parent directory as opposed to a sub-folder within the parent directory fixed it. Originally I was using the sub-folder for test purposes.