2009-12-17 61 views
4

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

我想使用ScriptManager,也许ToolKitScriptManager控件来帮助嵌入JavaScript文件。

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

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

我已经卸载并重新安装AJAX,复制System.Web.Extensions程序到我的箱子,检查了我的web.config设置至少50倍&,并已到这么多的搜索结果页面,论坛和博客,我的头正在旋转。

我知道它可能是简单的东西,我忽略了。我的缩写代码如下,有人可以帮助我考虑这一点,并抓住我失踪的东西。

感谢

的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> 

母版

<%@ 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> 

内容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> 

生成的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

我以前也遇到这个问题,

搜索在ajaxtoolkit嵌入的JavaScript文件,看看它的修改日期。并保证不会在未来。

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

我的问候

+0

我可能听起来很愚蠢,但仍然:给我找到* .axd,该怎么办?在我的情况下,它会产生一个HTTP状态代码500,但是我怎么处理这些信息呢? – Marcel 2013-09-09 18:59:50

+0

如果您发现某些文件响应500错误,并且您确信该文件在构建之前存在于“ajaxtoolkit”中,请尝试通过任何工具更改上次修改日期,这意味着您在错误的未来日期构建了dll。 – Mhmd 2013-09-20 19:13:21