惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
V
V2EX
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
The Cloudflare Blog
T
Tailwind CSS Blog
H
Help Net Security
腾讯CDC
爱范儿
爱范儿
人人都是产品经理
人人都是产品经理
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
Stack Overflow Blog
Stack Overflow Blog
D
DataBreaches.Net
C
Check Point Blog
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

博客园 - Kevin Wu

你是否也爱车 Asp..net 页面间跳转方法 Windows Server 2008 RC0正式发布、下载 通过Url抓取网页内容 如何生成静态页面的五种方案 (转)怎样用dos入侵局域网 闲里偷忙 [导入]学习网页制作: 用CSS来控制网页背景 (转)解决AJAX中使用UpdatePanel后再用Response.Write();等无法弹出对话框问题 3法 几种保持页面状态信息的讨论(转) 在Windows Servrer 2003下安装UDDI服务和UDDI .NET SDK JDK1.5+Tomcat5+MySql+Juddi 架设UDDI服务器 拒绝了对对象 'xp_cmdshell'(数据库 'master',所有者 'dbo')的 EXECUTE 权限 解决方法 无法将类型“ASP.login_aspx”转换为“System.Web.UI.WebControls.Login” 错误处理 终于考完试了~~~ 远程控制(3) 远程控制(2) 关于windows hook的提问 远程控制(1)
为你的aspx页面加上ajax enable - Kevin Wu
Kevin Wu · 2007-05-24 · via 博客园 - Kevin Wu

今天想在以前做的一个项目里的一些页面添加AJAX Extent控件,但是将控件一拉到页面上就出现了
"尝试读取或写入受保护的内存.这通常指示其他内存已损坏."
难道安装的文件出错了?我又重新安装了一次,提示重启,完了之后打开工程,重新操作,但是问题依旧.搞什么鬼呢?仔细想了想,原来是我的工程不是AJAX enable的.郁闷了,那不是要重新新建项目?
突然想起以前看过的一篇文章,通过改配置文件就可以使页面支持ajax控件的使用.但是现在又找不到了,唯有自己尝试吧.

新建一个ajax enable工程,打开里面的配置文件,打开本来工程的配置文件,开始比较了.
1.<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>

2. <system.web>节
(1)<pages>

    <pages>
      
<controls>
        
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      
</controls>
    
</pages>

(2)<compilation>

<assemblies>
        
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      
</assemblies>

(3)<httpModules>

    <httpModules>
      
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    
</httpModules>

3.添加了<system.web.extensions>,不过基本上没有内容

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

4.添加了<system.webServer>

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

到这里,原来没有的东西,都Copy过去了,保存,然后把控件一拉,OK!原来就这么简单.现在整个项目的页面都支持ajax控件的使用了.记住,下次别忘了