跟踪无效的回发或回调参数
在我未处理的异常日志记录中,我在一天中的给定页面上偶尔会看到此错误。我没有在页面上以编程方式创建的任何控件或将任何按钮数据绑定到页面上。
在我的日志记录中,我获取了当前处理程序,这是我知道页面和堆栈跟踪的地方,但是堆栈跟踪没有提供任何有意义的内容,因为它只是说它归结为 Page.ProcessPostData。
有没有办法可以记录更有意义的数据?比如它发布了什么以及它期望发布什么?
我永远无法在任何地方重现这个。
In my unhandled exception logging I see this error sporadically through the day on a given page. I don't have any controls that I create programmatically on the page or databind any buttons onto the page.
In my logging I grab the current handler which is where I know the page from and the stacktrace however the stacktrace doesn't give anything meaningful since it just says it boils down to Page.ProcessPostData.
Is there a way that I can log more meaningful data? Like perhaps what it got posted and what it expected to be posted?
I can never reproduce this anywhere.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以看到所有请求的表单参数,如下所示:
you can see all of the request's form parameters like this:
此问题的常见原因是用户在执行导致回发的操作之前没有等待整个页面呈现。这个页面有多大?用户变得不耐烦了吗?
我看到的另一个地方是中继器/模板化控件,里面有回发控件——就像中继器项目模板中的按钮——在回发后错误地进行数据绑定,而不是仅仅一次。然而,这总是会失败,因此可能性似乎较小。
我不知道如何从异常中获取更多信息...您如何开始捕获它?我认为发生此异常时 Page 对象本身根本不会被实例化,因此您可能必须使用自定义 HttpModule。你能在 ProcessRequest 周围放置一个 try/catch 吗?这应该使您能够访问 Request 对象和发布的数据。
A common cause of this problem is when a user does not wait for the entire page to render before performing an action that causes a postback. How big is this page? Are users getting impatient?
Another place I see it is with repeater/templated controls with postback controls inside -- like a button inside a repeater's item template -- that incorrectly databind after a postback instead of just once. However, that would consistently fail so seems less likely.
I'm not sure how to get more information from the exception... How are you catching it to begin with? I don't think the Page object itself is instantiated at all when this exception occurs, so you'd probably have to use a custom HttpModule. Can you put a try/catch around ProcessRequest? That should give you access to the Request object and the posted data.