Wednesday, March 26, 2014

Disable the ViewState in an ASP.NET web forms application....

...by putting something like this in the Master Page's code behind:

protected void Page_Load(object sender, EventArgs e)
{
   this.EnableViewState = false;
}

 
 

This cuts the the size of the hidden variable that comes up in HTML down to 108 characters. You might as well do this if you're not going to use ViewState. I guess it is kinda comic that a disabled ViewState is still 108 characters long.

No comments:

Post a Comment