Completely remove ViewState for specific pages

Posted by Kerido on Stack Overflow See other posts from Stack Overflow or by Kerido
Published on 2010-03-12T13:24:11Z Indexed on 2010/03/12 13:27 UTC
Read the original article Hit count: 251

Hi everybody,

I have a site that features some pages which do not require any post-back functionality. They simply display static HTML and don't even have any associated code. However, since the Master Page has a <form runat="server"> tag which wraps all ContentPlaceHolders, the resulting HTML always contains the ViewState field, i.e:

<input
  type="hidden"
  id="__VIEWSTATE"
  value="/wEPDwUKMjEwNDQyMTMxM2Rk0XhpfvawD3g+fsmZqmeRoPnb9kI="
/>

I realize, that when decrypted, this string corresponds to the <form> tag which I cannot remove. However, I would still like to remove the ViewState field for pages that only display static HTML. Is it possible?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about viewstate