开发者

ASP.NET State Error

开发者 https://www.devze.com 2022-12-19 01:08 出处:网络
I am have an asp.net page, where a list of products is shown in a drop down. When a user selects an item, corresponding price, available quantity etc. are shown in the corresponding text boxes. I have

I am have an asp.net page, where a list of products is shown in a drop down. When a user selects an item, corresponding price, available quantity etc. are shown in the corresponding text boxes. I have used ajax update panel to retrieve these information.

This approach seemed to work nicely at first, but sometimes when a product is selected, it takes too long for the price, quantities to change, and sometimes they don't even change. Th开发者_StackOverflowen I used firebug to see what happened to the ajax request, and I found out that the response that is coming from the server is something like this -

70|error|500|The state information is invalid for this page and might be corrupted.|

I have absolutely no idea what is wrong here.............


It might be a timing issue since you mentioned that sometimes it takes awhile for certain parts of the page to render on selection of a dropdownlist value. What might be happening is that when (quickly) selecting another, different value from your dropdownlist is triggering an ajax callback to the server before the current page request has finished rendering.

What this means is it is possible that the Event Validation field (__EVENTVALIDATION) value that is part of the page has not been rendered yet and therefore is not sent back to the server. ASP.NET uses this value for security reasons on postbacks to ensure that it originated from the same page and not some bogus page. If it is not provided in the request then ASP.NET assumes that it is a different page and therefore returns that specific error message.

You could disable event validation but that might leave your web app vulnerable to attack especially if its public facing.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号