- Can you put the ViewState in the Session if yes how and why?
Yes. we can store ViewState in Session.But this Session require good chunk of memory on the server.
// Store ViewState to Session
ViewState["myViewState"] = "ASP.Net";
Session["mySession"] = ViewState["myViewState"];
// Retrieve ViewState from Session
ViewState["RetrievedValue"] = Session["mySession"];
String ViewStateValue = ViewState["RetrievedValue"].ToString();