简体   繁体   中英

ASP.net ViewState

where is asp.net testing if a viewstate is valid and what happens if it is not valid?

Do I have to validate the ViewState by myself?

Asp.net 3.5

BR Thanks

where is asp.net testing if a viewstate is valid and what happens if it is not valid?

You'll get an exception if ViewState is invalid.

The ViewState is validated when the page is posted back and it happens before the Page_Load (LoadViewState green box on the pic below) event is raised. Read here. for more details

在此处输入图像描述

I can only recommend you reading this excellent article about ViewState and the ASP.NET lifecycle. It opened my eyes and I think it would help you understand how ViewState works. It has a section about validation and security:

http://msdn.microsoft.com/en-us/library/ms972976.aspx

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM