可以对表单中的隐藏字段进行操纵 问题参数 __VIEWSTATEGENERATOR
问题:
.net 网站生成 页面后,会有 <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTU5NzgzMjY1MQ8WBh4KUGFnZUNvdW50cwLsAh4JUGFnZUluZGV4Zh4JSnVtcFBhZ2VzAu0CFgICAw9kFhYCBw8QDxYGHg5EYXRhVmFsdWVGaWVsZAUEY19pZB4NRGF0YVRleHRGaWVsZAUHY190aXRsZR4LXyFEYXRhQm91bmRnFgIeCG9uY2hhbmdlBShTaG93KHRoaXMub3B0aW9uc1tzZWxlY3RlZEluZGV4XS52YWx1ZSk7EBUjBuaAu+ermQbljJfkuqwG5aSp5rSlBuS4iua1twbph43luoYG5rWZ5rGfBuaxn+iLjwblub/kuJwG5bGx5LicBuWuieW+vQbmuZbljZcG5Zub5bedBuemj+W7ugbmsZ/opb8G5rKz5Y2XBua5luWMlwnpu5HpvpnmsZ8G5rKz5YyXBui+veWugQblkInmnpcG6LS15beeBuWxseilvwblub/opb8G5LqR5Y2XBumZleilvwblroHlpI8J5YaF6JKZ5Y+kBueUmOiCgwbpnZLmtbcG6KW/6JePBuaWsOeWhgbmtbfljZcG6aaZ5rivBua+s+mXqAblj7Dmub4VIwExATIBMwE0ATUBNgIxOAIxOQIyMAIyMQIyMgIyMwIyNAIyNQIyNgIyNwIyOAIyOQIzMAIzMQIzMgIzMwIzNAIzNQIzNgIzNwIzOAIzOQI0MAI0MQI0MgI0MwI0NAI0NQMzNTQUKwMjZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dkZAIJDxYCHglpbm5lcmh0bWwF2hwgPGRpdiBzdHlsZT0ndGV4dC1hbGlnbjpjZW50ZXI7d2lkdGg6MTAwcHg7IGZsb2F0OmxlZnQ7J2NsYXNzPSdqeDAxJz48YSBocmVmPSdqeHNzLTIuaHRtbCc+5YyX5LqsPC9hPjwvZGl2PiA8ZGl2IHN0eWxlPSd0ZXh0LWFsaWduOmNlbnRlcjt3aWR0aDoxMDBweDsgZmxvY
解决办法:
重写以下两个方法
protected override object LoadPageStateFromPersistenceMedium()
{
return null;
}
protected override void SavePageStateToPersistenceMedium(object viewState) { }