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

推荐订阅源

博客园_首页
L
LINUX DO - 最新话题
PCI Perspectives
PCI Perspectives
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
Webroot Blog
Webroot Blog
V2EX - 技术
V2EX - 技术
S
Security @ Cisco Blogs
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
T
Tor Project blog
Know Your Adversary
Know Your Adversary
S
Secure Thoughts
Project Zero
Project Zero
Hacker News: Ask HN
Hacker News: Ask HN
C
Cisco Blogs
K
Kaspersky official blog
Google DeepMind News
Google DeepMind News
N
News | PayPal Newsroom
V
Vulnerabilities – Threatpost
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
C
Cyber Attacks, Cyber Crime and Cyber Security
L
Lohrmann on Cybersecurity
N
News and Events Feed by Topic
The Last Watchdog
The Last Watchdog
D
DataBreaches.Net
W
WeLiveSecurity
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
Y
Y Combinator Blog
TaoSecurity Blog
TaoSecurity Blog
AWS News Blog
AWS News Blog
T
Threat Research - Cisco Blogs
大猫的无限游戏
大猫的无限游戏
I
InfoQ
Cloudbric
Cloudbric
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Forbes - Security
Forbes - Security
Attack and Defense Labs
Attack and Defense Labs
The Cloudflare Blog
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
Cyberwarzone
Cyberwarzone

博客园 - nikytwo

Install Tomcat 7 on CentOS, RHEL, or Fedora [转]如何安全的存储密码 打败 IE 的葵花宝典:CSS Bug Table 域名的DNS解析指南 IE6实现PNG图片透明 JQuery EasyUI 之 combobox plugin JQuery EasyUI 之 validatebox plugin JQuery easyUI 之 datebox plugin Asp.NET + OWC 输出Chart(图表) Route命令使用详解 CascadingDropDown Apache + PHP 安装日志 CSS图片垂直居中 - nikytwo - 博客园 CSS 条件缩放图片 SQL:行合并问题 & 使用 SP_executesql 从exec('SQL语句') 中得到一个返回值 Dataset.Readxml(stream) 错误 “缺少根元素” 分页 web Service 传输 Dataset (大数据量) Delphi 调用 Webservice (ASP.NET)
最近写 ASP.NET 中出现的错误 & 实现DataTable和DataSet类型的客户端/服务器端自动转换
nikytwo · 2009-05-15 · via 博客园 - nikytwo

CausesValidation 属性设置:未设置为 False 而导致 Ajax 回调时无反应,或设置了 True 而导致即使输入不合要求也提交后台处理(在无 Submit Button 情况下)

客户端调用 WebService ,其中 WebService 返回的是 DataSet 对象 :出现错误提示“WebMethod Dataset System.InvalidOperationException: A circular reference was detected......”

解决方法:

1. 在 WebService 方法前添加 [System.Web.Script.Services.ScriptMethod],如下:

1 [System.Web.Script.Services.ScriptMethod(ResponseFormat=System.Web.Script.Services.ResponseFormat.Xml)]
2 public DataSet GetData()
3 
4 }

不过这种方法返回的是 XML ,客户端调用 WebService 方法后,返回的是 XML 文档内容。

2.在 Web.Config 文件启用ASP.NET AJAX Futures CTP中自带的DataTable和DataSet相关JavaScriptConverter组件(参见:SP.NET AJAX异步调用Web Service和页面中的类方法 - 服务器端和客户端数据类型的自动转换(续4)),如下:

首先,确保项目引用了 Microsoft.Web.Preview.dll 程序集。(去http://go.microsoft.com/fwlink/?LinkID=77294下载"Microsoft ASP.NET AJAX

Futures CTP" 安装好后,在默认安装文件夹(C:"Program Files"Microsoft ASP.NET"ASP.NET 2.0 AJAX Futures January CTP"v1.0.61025)中可以找到.)ASP.NET AJAX Futures CTP:这一部分就是被ASP.NET AJAX暂时“抛弃”的原有CTP版本中“非核心”的部分,也叫做“Value-add”包,其中包括服务器端的扩展器控件(Extender Control)、Web部件,客户端的各种控件、拖放功能实现、ASP.NET AJAX XML脚本等。所谓“抛弃”,实际上只是意味着微软公司暂时不会对这些内容进行官方的支持,而选择使用“社区支持”的方法。这样,微软公司将不会为这部分 内容提供详细的开发文档,开发者只能在社区中互相讨论以找到问题的解决方案。若要安装这部分内容,则必须首先安装“核心”部分的ASP.NET 2.0 AJAX Extensions。(参见:ASP.NET Ajax程序设计—第I卷第2章第3节

添加引用后,则再 Web.config 文件中添加如下内容:

<system.web.extensions> 
<scripting> 
<webServices> 
<jsonSerialization> 
<converters> 
<add name="DataSetConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataSetConverter, Microsoft.Web.Preview"/> 
<add name="DataRowConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataRowConverter, Microsoft.Web.Preview"/> 
<add name="DataTableConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataTableConverter, Microsoft.Web.Preview"/> 
</converters> 
</jsonSerialization> 
</webServices> 
</scripting> 
</system.web.extensions>

 在添加上面的内容是,要先设置构架,如下:

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

一切 ok~哈哈~