zoukankan      html  css  js  c++  java
  • 如何解决ajax的Type,Sys未定义

    好久没有动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>

    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"/>

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

    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

  • 相关阅读:
    九个PHP有用功能
    ajax的上拉功能
    jquery 插件
    任务08(全体)——第一次半月学习总结
    任务02——安装 Intellj IDEA,编写一个简易四则运算小程序,并将代码提交到 GitHub
    任务01——谈谈对参与工作室的预期
    任务08
    任务03
    任务02
    任务01
  • 原文地址:https://www.cnblogs.com/suncarry/p/1639633.html
Copyright © 2011-2022 走看看