另一个ASP.net AJAX SYS未定义错误

时间:2022-11-06 16:18:20

Im at my wits end here. I have an ASP.net 2.0 Web Project Developed in VS 2008. The problem occurs on my dev XP system and our Windows 2000 and 2008 servers. The project uses AJAX 1 and references System.Web.Extensions 1.0.61025.0 and AJAXControlTookKit 1.0.10618.0.

我的智慧在这里结束了。我有一个在VS 2008中开发的ASP.net 2.0 Web项目。问题出现在我的dev XP系统和我们的Windows 2000和2008服务器上。该项目使用AJAX 1并引用System.Web.Extensions 1.0.61025.0和AJAXControlTookKit 1.0.10618.0。

I am trying to use the ScriptManager and maybe the ToolKitScriptManager control to help with embedding javascript files.

我正在尝试使用ScriptManager和ToolKitScriptManager控件来帮助嵌入javascript文件。

Before I get to trying to embed, I have to get rid of the dreaded SYS undefined javascript error. Actually, if I use the ScriptManager to include javascript files using the Path attribute it works. The SYS error is still there, but javascript files are included on the generated page and they work. Right now I am working with a blank page that only includes some test text. This page is wrapped in a MasterPage that includes an empty ScriptManager.

在我尝试嵌入之前,我必须摆脱可怕的SYS未定义的javascript错误。实际上,如果我使用ScriptManager使用Path属性包含javascript文件,它可以工作。 SYS错误仍然存​​在,但javascript文件包含在生成的页面上,并且它们可以正常工作。现在我正在处理一个只包含一些测试文本的空白页面。此页面包含在包含空ScriptManager的MasterPage中。

When I debug this page I get an error on Sys.WebForms.PageRequestManager (see generated HTML below).

当我调试此页面时,我在Sys.WebForms.PageRequestManager上收到错误(请参阅下面生成的HTML)。

I have uninstalled and reinstalled AJAX, copied the System.Web.Extensions to my bin, checked my web.config settings at least 50 times&and have been to so many search results pages, forums, and blogs that my head is spinning.

我已经卸载并重新安装了AJAX,将System.Web.Extensions复制到我的bin,检查了我的web.config设置至少50次,并且已经访问了我脑子里正在旋转的很多搜索结果页面,论坛和博客。

I know its probably something simple I am overlooking. My abbreviated code is below, can someone help me think through this and catch what I am missing.

我知道这可能是我想要的简单。我的缩写代码在下面,有人可以帮助我思考并抓住我所缺少的东西。

Thanks

Web.config

<?xml version="1.0"?>
<configuration>
  <configSections>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>

  <appSettings>
    …
  </appSettings>

  <location path="PartnerPrograms">
    …
  </location>

  <system.web>
  <xhtmlConformance mode="Transitional" />
  <authentication mode="Forms">
     …
  </authentication>
  <trace enabled="false"/>
  <compilation debug="false">
      <assemblies>
        <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
    <httpHandlers>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
    </httpHandlers>

    <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </httpModules>

    <customErrors mode="Off">
    </customErrors>

    <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </controls>
    </pages>

    <siteMap defaultProvider="AspNetXmlSiteMapProvider">
      …
    </siteMap>

  </system.web>

  <system.web.extensions>
    <scripting>
      <webServices>
        <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
        <!--
      <jsonSerialization maxJsonLength="500">
        <converters>
          <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
        </converters>
      </jsonSerialization>
      -->
        <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
        <!--
        <authenticationService enabled="true" requireSSL = "true|false"/>
      -->

        <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
           and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
           writeAccessProperties attributes. -->
        <!--
      <profileService enabled="true"
                      readAccessProperties="propertyname1,propertyname2"
                      writeAccessProperties="propertyname1,propertyname2" />
      -->
      </webServices>
      <!--
      <scriptResourceHandler enableCompression="true" enableCaching="true" />
      -->
    </scripting>
  </system.web.extensions>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </handlers>
  </system.webServer>
</configuration>

MasterPage

<%@ Master Language="C#" AutoEventWireup="true" Codebehind="…" Inherits="…" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    …
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" ID="ScriptManager" />
…
    </form>
</body>
</html>

Content ASPX Page

内容ASPX页面

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="…" Inherits="…" MasterPageFile="…" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div>
    Hello from TestMaster.aspx
    </div>
</asp:Content>

Generated HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
    Untitled Page
</title>
    <link href="App_Themes/GFYStyle/main-styles.css" type="text/css" rel="stylesheet" /><link href="App_Themes/GFYStyle/menu.css" type="text/css" rel="stylesheet" /></head>
<body>
    <form name="aspnetForm" method="post" action="testmaster.aspx" id="aspnetForm">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEwMDUyNjYzMjhkZA==" />
</div>

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>


<script src="/WebResource.axd?d=_WiqftJEACb-AG_CJoE3Ow2&amp;t=633918597608321164" type="text/javascript"></script>


<script src="/ScriptResource.axd?d=ijkJL7RSAe839q84O1r7AVMBB0ct2fvAOK5xpjCeZxrwP0ygLeMB_n15PEMyX4_bqkpJiL-kZfiCFgkZo8QpQuTDwrSUkIcLrOxl8UfjJBc1&amp;t=633921693043429658" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=ijkJL7RSAe839q84O1r7AVMBB0ct2fvAOK5xpjCeZxrwP0ygLeMB_n15PEMyX4_bqkpJiL-kZfiCFgkZo8QpQjLl6r3RCBV1yA4P_b8fb641&amp;t=633921693043429658" type="text/javascript"></script>
    <script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ctl00$ScriptManager1', document.getElementById('aspnetForm'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>
</script>

    <div>

    <div>
    Hello from TestMaster.aspx
    </div>

    </div>


<script type="text/javascript">
//<![CDATA[
Sys.Application.initialize();
//]]>
</script>
</form>
</body>
</html>

1 个解决方案

#1


1  

i have faced this problem before,

我以前遇到过这个问题,

search for the embedded javascript files in ajaxtoolkit and see the modified date for it. and be ensure to be not in the future.

在ajaxtoolkit中搜索嵌入的javascript文件,并查看其修改日期。并确保不会在将来。

to be sure about that, check links appear in viewsource with *.axd and try to run eveyone, if you see someone response an error, here you found the problem.

为了确保这一点,检查链接出现在viewsource与* .axd并尝试运行eveyone,如果你看到有人回复错误,在这里你发现了问题。

My Regards

#1


1  

i have faced this problem before,

我以前遇到过这个问题,

search for the embedded javascript files in ajaxtoolkit and see the modified date for it. and be ensure to be not in the future.

在ajaxtoolkit中搜索嵌入的javascript文件,并查看其修改日期。并确保不会在将来。

to be sure about that, check links appear in viewsource with *.axd and try to run eveyone, if you see someone response an error, here you found the problem.

为了确保这一点,检查链接出现在viewsource与* .axd并尝试运行eveyone,如果你看到有人回复错误,在这里你发现了问题。

My Regards