Cannot hide VIEWSTATE hidden field in ASP.NET

I need to hide the hidden VIEWSTATE and EVENTVALIDATION fields on my ASP.net page during RUN.

I managed to remove EVENTVALIDATION so .............

<%@ Page enableEventValidation="false" EnableViewState="false" %>

But VIEWSTATE is still there, and I cannot get rid of it, and I need. (hard to explain why)

Is there any other way to get rid of it?

Thanks in advance!

+3
source share
5 answers

You need to override the following methods on your page:

protected override void SavePageStateToPersistenceMedium(
object viewState)
{
}

protected override object LoadPageStateFromPersistenceMedium()
{
    return null;
}

See here: http://weblogs.asp.net/ngur/archive/2004/03/08/85876.aspx You can use this code to rename the viewstate variable if you want, but I would recommend it.

runat = "server" , .

viewstate asp.net. , , , viewstate.

+4

__VIEWSTATE, <form runat="server">. , , .

+3

ASP.NET MVC. _VIEWSTATE.

0

ASP.NET 2.0 __VIEWSTATE , , , , .

, , - <form runat="server"> ( HTML) ASP.NET MVC. , ASP.NET MVC .

/ . ASP.NET

0

. . , , viewstate, - MVC.

0

Source: https://habr.com/ru/post/1729206/


All Articles