禁用 ASP.NET 事件验证
我们厌倦了在我们的网络应用程序中收到有关“无效的回发或回调参数”的异常。 什么情况会导致此错误?
在与用户交谈后,我们确定出现这种情况的一个可能原因是他们单击导致回发的内容,然后在初始回发完成之前单击其他内容。
禁用事件验证有什么危害? 无论如何,我们安装了 SecureIIS 以提高安全性。
更新:在某些地方,我们使用Javascript来修改某些控件值,例如下拉列表选项(我们这样做是为了提供更好的用户体验 - 减少回发)。 这很可能会导致错误。 我们对所有用户输入进行了严格的编辑,因此我们将继续禁用 EventValidation。 谢谢你!
We're tired of getting exceptions regarding "Invalid postback or callback argument" in our web app. What scenario(s) causes this error?
After talking to users, we've determined that one possible cause of this is when they click something that causes a postback, and then click something else before the initial postback completes.
What is the harm in disabling event validation? For what it's worth, we have SecureIIS installed for increased security.
UPDATE: In some places, we use Javascript to modify certain controls values, such as a drop-down list options (we do this to make a better user experience - less postbacks). This is likely causing the error. We have strict edits in place for all user input, so we are going to proceed with disabling EventValidation. Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事件验证验证这些值没有被手动篡改,例如超出所涉及的控件允许的范围。 例如,如果您有一个下拉列表,其中包含三个选项 1、2 或 3...,如果用户(或恶意中间人)将值更改为 4,则验证将失败。
只要您在每个处理程序中进行自己的检查以确保传入值有效,并且您的代码的结构方式使得意外输入不会导致任何事情发生(最安全),那么关闭验证就可以了。
Event Validation verifies that the values have not been tampered with manually, e.g. outside the scope permitted by the controls involved. For example, if you have a drop-down list with three choices 1, 2, or 3... if the user (or malicious middleman) changes the value to 4, validation will fail.
As long as you are doing your own checking in each handler to ensure incoming values are valid, and your code is structured in such a way that unexpected input will cause nothing to happen (safest), you will be fine with validation turned off.