问题
Web application is throwing a handful of these errors everyday.
Exception: System.FormatException: Invalid character in a Base-64 string.
at System.Convert.FromBase64String(String s)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState)
at System.Web.UI.HiddenFieldPageStatePersister.Load()
I think the error's coming from decoding the ViewState, but I'm having trouble just triggering the error. I've never been able to trigger the error in dev, only prod. And even in prod, I can't reproduce the error easily. There are several filters for a dataview on the page, and selecting different values will eventually throw the error, but not in any pattern I can figure out. Sometime's it's the very first time I change a filter, sometimes no combination will.
回答1:
it could be one of the reasons below:
- Application Pool Recycling
- Server Farms or Server Clusters
- Proxy servers and Virus Scanners
As first thing I would Use a specific key in the machine.config to prevent automatic key generation on each process start
来源:https://stackoverflow.com/questions/8731010/invalid-character-in-a-base-64-string-viewstate