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

推荐订阅源

T
Threatpost
V
Vulnerabilities – Threatpost
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
G
GRAHAM CLULEY
S
Securelist
P
Palo Alto Networks Blog
MongoDB | Blog
MongoDB | Blog
A
Arctic Wolf
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
WordPress大学
WordPress大学
Project Zero
Project Zero
T
Threat Research - Cisco Blogs
L
Lohrmann on Cybersecurity
C
Cyber Attacks, Cyber Crime and Cyber Security
F
Fortinet All Blogs
博客园 - 叶小钗
B
Blog RSS Feed
C
Cisco Blogs
Google DeepMind News
Google DeepMind News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Apple Machine Learning Research
Apple Machine Learning Research
G
Google Developers Blog
K
Kaspersky official blog
D
Docker
Latest news
Latest news
Cisco Talos Blog
Cisco Talos Blog
T
Tor Project blog
Cyberwarzone
Cyberwarzone
Security Latest
Security Latest
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
C
Check Point Blog
J
Java Code Geeks
Simon Willison's Weblog
Simon Willison's Weblog
T
Tenable Blog
Recent Announcements
Recent Announcements
T
Tailwind CSS Blog
H
Help Net Security
L
LINUX DO - 热门话题
T
The Exploit Database - CXSecurity.com
Jina AI
Jina AI
S
SegmentFault 最新的问题
MyScale Blog
MyScale Blog
NISL@THU
NISL@THU
美团技术团队
腾讯CDC

博客园 - 天下

[转]开始PFC之旅行 查询同一表内多字段同时重复记录的SQL语句 数据库设计中的14个关键技巧收藏[转] 走出海量数据及访问量压力困境收藏[转] 大型网站架构设计[转] (转)各主要数据库的连接串 - 天下 - 博客园 SQL Anywhere 10 关于 COMMIT 掉数据的问题 - 天下 vs2005水晶报表页面打开数据库登录框提示取消方法[转] .net2.0 +asa 10 连接程序 PD12.5 生成 PB 中table的扩展属性 - 天下 datagrid格式变乱解决方案---------------网页内强制折行与不折行的解决方案 Report Service 为用户“NT AUTHORITY、NETWORK SERVICE”授予的权限不足,无法进行此操作。(rsAccessDenied)处理 [转]SQL Server一些常见性能问题的总结 SQL SERVER 添加序号列 sharepoint Site Data Web 服务中的错误。 (0x80042616)PortalCrawl Web 服务中的错误。 (0x80042617)处理 TFS的TF31004:错误 创建WebPart时的数据库连接问题。 Visual Studio 2005 Team Foundation Server Trial Edition下载 Team Foundation Server架设之删除项目
Asp.net2.0回发或回调参数无效问题的解决
天下 · 2008-04-16 · via 博客园 - 天下

详细错误:回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true" %> 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。

出现这种情况的原因很多,我总结了一下,解决方法有如下几种:

1、.将<pages enableEventValidation="true"/>改为<pages enableEventValidation="false"/>,但是这样取不到客户端增加的值。

2、Form嵌套,一个页面只能有一个Form,仔细检查代码就可以解决。

3、在下拉菜单中使用ajax,常见于省市联动菜单,可能是由于在aspx页面赋给了下拉菜单初始Item值,在事件回发时提示该错误,将下拉菜单初始Item值删除,在绑定事件中添加Item项。

4、把GridView绑定数据那块放进if(!Page.IsPostBack)里~~~就行啦~~,呵呵

5、.将dropdownlist的value值设为数字或者英文,不要使用中文。

     或者在web.config中添加如下语句:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

6、使用RegisterForEventValidation注册客户端控件的值。

可能还有别的方法,不过我没有注意到。我是参考的第三种方法实现的。

解决方法:在Page_Load之前加入如下代码

protected override void Render(HtmlTextWriter writer)
    {

         ClientScript.RegisterForEventValidation(DropDownList1.UniqueID, "argument");
        base.Render(writer);
    }

DropDownList1就是你要使用客户端脚本动态增加内容的控件,而argument就是你要加入的值。例如本来DropDownList1是空的,你用脚本为它增加了“中国”,“美国”等值,这里的代码就改成

ClientScript.RegisterForEventValidation(DropDownList1.UniqueID, "中国");

ClientScript.RegisterForEventValidation(DropDownList1.UniqueID, "美国");

原理:就是因为vs2005的这个数据验证问题了,"在asp.net render DropDownList 时,会遍历DropDownList的item,并记录所有可能的postback的值,计算的结果会被保存在page中,

<input type="hidden"
       name="__EVENTVALIDATION"
       id="__EVENTVALIDATION"
       value="/wEWBQKGg9abDQKd9sHMBgKc9s…….."
/>
这个过程发生在control的Render()方法中
当页面postback时,ASP.NET会根据这个隐藏值检查postback values,如果找不到对应信息,就会报错"(引自http://recordsome.blogsome.com/2006/05/

所以我们重写Render,将由脚本加入控件中的值加入到隐藏值中,就不会出现找不到相应信息的错误了。