如何解码 ASP.NET EventValidation 和 ViewState?
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.
我不确定 EventValidation,但您可以使用 Fritz Onion 的ViewState Decoder 解码 ViewState 。
我最近需要解码 ViewStates,发现这个工具很有用: View Statedecoder
Create a simple windows app and use Convert.FromBase64(str)
to decode ViewState
data if it is not encrypted.
Note: GridView causes encryption.
You can use this link if use python.
Best way is use this link .
A small Python 3.5+ library for decoding ASP.NET viewstate.
First install that: pip install viewstate
>>> from viewstate import ViewState
>>> base64_encoded_viewstate = '/wEPBQVhYmNkZQ9nAgE='
>>> vs = ViewState(base64_encoded_viewstate)
>>> vs.decode()
('abcde', (True, 1))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.