How ASP.NET MVC removes ViewState from application?
I'm looking in ASP.NET MVC source and don't found where ViewState is removed from application.
(The ViewState is not just disabled, it is removed of all pages in application)
Thanks!
Update:
Is r开发者_如何学编程emove Viewstate hidden field possible?
That's easy; it isn't removed. You can still set and read ViewState. Just don't expect it to contain anything from the previous request. This is actually convenient, because it means that certain ASP.NET server controls which store their property values in ViewState can be made to work in ASP.NET MVC. As long as it's not important to persist ViewState from one request to another, these controls still work fine.
Removing the persistence of ViewState from one request to another makes it close to useless, of course. This is why people generally say that ASP.NET MVC "doesn't have ViewState." This isn't technically accurate; ViewState actually does exist; it just doesn't exist in a form which is useful for anything.
MVC does not use the viewstate - it is completely stateless (as the web should be).
You may have to change your mindset a little and think about your apps running under a request-response model (which it always has, but standard asp.net used viewstate to try and "trick" the developer, if you will, into thinking, or coding as if a page had state.)
ViewState is not a part of the ASP.NET MVC page life cycle. ViewState is only available in ASP.NET WebForms applications.
This also means that you are not able to use most of the ASP.NET WebForms controls which rely on ViewState
精彩评论