Is it possible to decode EventValidation and ViewState in ASP.NET?

[亡魂溺海] 提交于 2019-12-21 07:56:12

问题


How to decode the ASP.NET EventValidation and ViewState?


回答1:


I answered a similar question recently, Getting values from viewstate using JQuery?.

Basically, by default ViewState is just Base64-encoded, so you can decode it as long as the administrator hasn't configured the site to encrypt it. Quoting from my previous answer:

If you are writing the control for your own consumption and you only need to read from ViewState, you could do so, but I wouldn't recommend it unless you find a well-debugged library to parse it for you. The format is a bit hairy (see ViewState: All You Wanted to Know for more details).

That link provides an extremely thorough and clear introduction to ViewState.

As for Event Validation, I'm unsure whether it's Base64-encoded or if it just looks like Base64 (I can't find a conclusive, authoritative reference). This Rexiology article might help though.




回答2:


I'm not sure about EventValidation, but you can decode ViewState by using Fritz Onion's ViewState Decoder.




回答3:


I needed to decode ViewStates recently and found this tool useful: View State decoder




回答4:


Create a simple windows app and use Convert.FromBase64(str) to decode ViewState data if it is not encrypted.

Note: GridView causes encryption.



来源:https://stackoverflow.com/questions/1092697/is-it-possible-to-decode-eventvalidation-and-viewstate-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!