2009-12-17 60 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