views:

995

answers:

3

I am learning ASP.NET MVC and many concepts of "ASP.NET" like authentication, authorization, session state still apply to it.

But from whatever little I have understood, I don't see that ViewState is still relevant in an ASP.NET application. But it is there (property of System.Web.Mvc.ViewPage)! Is it there only for compatibility reasons or it still have some purpose/use?

+3  A: 

Its present because ViewPage inherits from Page. However Page itself had no use for ViewState its used by WebControls. It is possible to include original WebControls in a View but doing so would be completely missing the point of separating control from view.

AnthonyWJones
You reasoning is correct but I chose to accept another answer because it answers decisively!
Hemant
You get my vote though :)
Hemant
+2  A: 

Yes, that is correct. ViewState is not relevant. More on differencies between Page Model and MVC here:

Compatibility of ASP.NET Web Forms and ASP.NET MVC

Dzmitry Huba
+1  A: 

Personally I think its obsolete. The only time I've seen ViewState in an ASP.Net MVC app is when someone 'accidentally' added a ASP.Net control to a page.

eyesnz
I get your message but since ASP.NET web forms are not obsolete, ViewState is also not obsolete. Its just not used by ASP.NET **MVC**!
Hemant