I’ve been working with a customer who is working with my application as a typical end user would. This means, they often use the browser in ways the application isn’t meant to be used <g>. If you want to translate that: It means they use the BACK button a lot.
One of my application pages is fairly complex and it contains about 50 fields or so which are displayed with a tabbed display and used to display inventory data.
I’ve been getting a ton of Invalid Viewstate errors which looks like this in my error log:
/store/admin/EditInventoryItem.aspx?Sku=KWR_TSHIRT_BW_ORANGE
Invalid_Viewstate
Client IP: 68.116.115.30
Port: 47723
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.1 (KHTML, like Gecko) Safari/312
ViewState: dDwtMTc0Nzg0MDU5OztsPFd3d2ViY2hlY2tib3gxO3R4dG5vd2ViO1d3d2ViY2hlY2tib3gyOz4+wsDm0DO4DrTgsEuGylUVMawoGG0=
Http-Referer: http://www.kidswhorip.com/store/admin/EditInventoryItem.aspx?Sku=KWR_TSHIRT_BW_ORANGE
Path: /store/admin/EditInventoryItem.aspx.
on 7/17/2005 12:10:52 am
--- Stack Trace ---
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadPageViewState()
at System.Web.UI.Page.ProcessRequestMain()
--- Request Information ---
Full Url: http://www.kidswhorip.com/store/admin/EditInventoryItem.aspx?Sku=KWR_TSHIRT_BW_ORANGE
IP: 68.116.115.30
Referer: http://www.kidswhorip.com/store/admin/EditInventoryItem.aspx?Sku=KWR_TSHIRT_BW_ORANGE
Browser: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.1 (KHTML, like Gecko) Safari/312
Login: WEB\rod
Locale: en
--- Raw Post Buffer ---
__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=dDwtMTc0Nzg0MDU5OztsPFd3d2ViY2hlY2tib3gxO3R4dG5vd2ViO1d3d2ViY2hlY2tib3gyOz4%2BwsDm0DO4DrTgsEuGylUVMawoGG0%3D&txtsku=KWR_TSHIRT_BW_ORANGE&txt _EditTabs=Detail
... additional data removed for brevity
I’ve seen the errors happening on the user’s browser configuration but no matter how I try here I can’t duplicate a repeatable scenario.
What’s even worse is that this page has ViewState disabled – my app doesn’t need or use it, so the viewstate used is only in use for ASP.NET internally.
After some more searching I ran intot he following KB Article:
Intermittent Invalid Viewstate Error in ASP.NET Web pages
This article suggests that the error might occur because of Application Pool cycling. The solution to this problem is to set a flag in machine.config to prevent ASP.NET to generate a new key everytime an Application starts.
I tried to get this to fail, simply by restarting IIS, but that didn’t do it for me – I got no failure, so I’m still not quite sure what is causing the Invalid ViewState scenario to occur.
The first thing I’m trying right now is to set EnableViewStateMac=”false” in the page and see if that helps. I suspect this will fix the problem, but I’d still like to know why the validation is failing on the host server.
Other Posts you might also like