1.問題點:使用FILEUPLOAD控件且上傳較大文件時,頁面顯示Internet Explorer
无法显示该网页

好久没有动ajax了,突然一使用毛病多多,提示Type未定义,Sys未定义,其实这个东西我,以前遇到过,也解决了,时间一长就忘记了。今天就把解决方法写出来和大家分享。
  其实很简单,此时我们要做的是在 web.config 中 <system.web>
一节下面添加类似如下内容:
view plaincopy to clipboardprint?
<httpHandlers>  
  <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> 
  <httpHandlers>
    <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>

1.解決:在web.config中更改默認請求的最大字節數,如下,
    <httpRuntime maxRequestLength=”102400″
useFullyQualifiedRedirectUrl=”true” executionTimeout=”6000″
minFreeThreads=”8″  minLocalRequestFreeThreads=”4″  
  appRequestQueueLimit=”100″ />

ok,到处解决SYS未定义问题,但WEBSERVICE为定义依然存在,建立空ajax
enabled web application,观察WEB.CONFIG文件发现有关WEBSERVICE的配置,
view plaincopy to clipboardprint?
<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″/> 
<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″/>

2.問題:JS與ASP.NET相互操作(刪除/增加COOKIES)
2.解決:JS document.cookie+=”path=/”,ASP.NET httpcookie.path=”/”
    重要:保證JS與ASP.NET Cookie PATH相同

尝试加入上面节点,
测试成功,完整的配置如下

3.問題:使用AJAX.NET時,頁面顯示SYS未定義
3.解決:在WEB.CONFIG中,增加如下配置項:
    <httpHandlers>
      <remove verb=”*” path=”*.asmx”/>
      <add verb=”*” path=”*.asmx” validate=”false”
type=”Microsoft.Web.Script.Services.ScriptHandlerFactory,
Microsoft.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>

view plaincopy to clipboardprint?
<system.web>  
  <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> 
<system.web>
  <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>
注意是在<system.web>里面
就是这些了。

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/jok127/archive/2009/12/03/4935004.aspx

admin

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注