2012-05-08 37 views
1

我使用asp.net 2.0框架時出現此錯誤。我在網上搜索,但沒有找到答案,謝謝大家提前。以下是描述。asp.net 2.0 ajax框架拋出System.ArgumentOutOfRangeException錯誤當輸入字符串'','

<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
     <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
      <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
      <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
       <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/> 
       <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
       <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
       <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
      </sectionGroup> 
     </sectionGroup> 
    </sectionGroup> 

以上是Web.config中的配置部分。使用[AjaxMethod(HttpSessionStateRequirement.ReadWrite)]屬性來定義服務器端的ajax方法。方法如下:public virtual AjaxResult Add(string[] values, string[] valueParameters, int editMode)。當string[]值中的一個string包含\或\,它會失敗,服務器得到的參數被''分成兩部分,如果它是'H \,H',則變成'H '和'',如果是'H','H'則變爲''和'\ H'。這裏是信息:

「{ '的IsValid':假, '價值':[], '消息': '指數邊界陣列的 外部。', 'UnformattedMessage':空, 'Type':6}「

我調試了它,Ajax框架將輸入字符串轉換爲Json的'"' + o.replace(/(["\\])/g, '\\$1') + '"'正則表達式。例如,

"DSF\,DF" 

將被翻譯成

"DSF\\,DF" 

我認爲這是好的,但在asp.net框架不能正確識別它。

請幫幫我。

+0

謝謝大家,我使用Ajax.dll 5.6.3.4,我發現有一個版本5.7.22.2。但是我找不到下載鏈接,有沒有人可以提供給我一個鏈接,謝謝大家。 – espider

回答

0

你確定你有合適的版本? 看到這個... http://www.asp.net/ajax/documentation/live/ConfiguringASPNETAJAX.aspx我希望它會幫助你

+0

我比較了兩個配置,唯一的區別是版本。在示例中,它使用1.0.61025.0,我們的版本是3.5.0.0 – espider

+0

您是否嘗試安裝SP1? http://www.microsoft.com/en-us/download/details.aspx?id=22 –

+0

是的,我認爲這是一個分析後字符串ajax.dll的錯誤。 – espider

相關問題