473,509 Members | 2,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Completely disable viewstate

Hello,
I have a aspx page in which I would like to eliminate all of
the hidden variables as this page would be imported to an email client
and the hidden controls are usually rendered in the mail client. The
asp.net form does have the form input hidden control inspite the
viewstate is disabled at the page level. Isnt there a way to eliminate
it? And, as per my understanding, it just cant be eliminated. Now, I
was trying to parse the page treating it as a XML doc and remove the
hidden control. The problem there would be - there is no guarantee that
the XML document is well formed as the page contains formatted text and
might miss some of the closing tags. Is there a better way to get rid
of the input hidden form level viewstate ( ID = "__VIEWSTATE") ?

Thanks,
Sam.

Jan 3 '07 #1
6 1887
<sr*****@mailcity.comwrote in message
news:11********************@i12g2000cwa.googlegrou ps.com...
And, as per my understanding, it just cant be eliminated.
I believe you are correct...
Jan 3 '07 #2
as you don't care about postback just add to your page:
// override standard viewstate handler with do nothing
protected override void SavePageStateToPersistenceMedium(Object state)
{
}
-- bruce (sqlwork.com)

sr*****@mailcity.com wrote:
Hello,
I have a aspx page in which I would like to eliminate all of
the hidden variables as this page would be imported to an email client
and the hidden controls are usually rendered in the mail client. The
asp.net form does have the form input hidden control inspite the
viewstate is disabled at the page level. Isnt there a way to eliminate
it? And, as per my understanding, it just cant be eliminated. Now, I
was trying to parse the page treating it as a XML doc and remove the
hidden control. The problem there would be - there is no guarantee that
the XML document is well formed as the page contains formatted text and
might miss some of the closing tags. Is there a better way to get rid
of the input hidden form level viewstate ( ID = "__VIEWSTATE") ?

Thanks,
Sam.
Jan 3 '07 #3
On 3 Jan 2007 07:48:00 -0800, sr*****@mailcity.com wrote:
Hello,
I have a aspx page in which I would like to eliminate all of
the hidden variables as this page would be imported to an email client
and the hidden controls are usually rendered in the mail client. The
asp.net form does have the form input hidden control inspite the
viewstate is disabled at the page level. Isnt there a way to eliminate
it? And, as per my understanding, it just cant be eliminated. Now, I
was trying to parse the page treating it as a XML doc and remove the
hidden control. The problem there would be - there is no guarantee that
the XML document is well formed as the page contains formatted text and
might miss some of the closing tags. Is there a better way to get rid
of the input hidden form level viewstate ( ID = "__VIEWSTATE") ?

Thanks,
Sam.
You'll probably run into problems trying to get a XML compliant document
from a HTML page unless you go out of your way to make the page compliant.

If you really need to eliminate the viewstate you could use a regular
expression to find and remove it.
--
Bits.Bytes
http://bytes.thinkersroom.com
Jan 3 '07 #4
Thanks for the reply. I would appreciate any pointers in specific the
use of regular expressions to remove it from the page.

P.S: Overriding 'SavePageStateToPersistenceMedium' clears the viewstate
completely but the hidden control is still rendered on the page.

Thanks again,
Sam.

Rad [Visual C# MVP] wrote:
On 3 Jan 2007 07:48:00 -0800, sr*****@mailcity.com wrote:
Hello,
I have a aspx page in which I would like to eliminate all of
the hidden variables as this page would be imported to an email client
and the hidden controls are usually rendered in the mail client. The
asp.net form does have the form input hidden control inspite the
viewstate is disabled at the page level. Isnt there a way to eliminate
it? And, as per my understanding, it just cant be eliminated. Now, I
was trying to parse the page treating it as a XML doc and remove the
hidden control. The problem there would be - there is no guarantee that
the XML document is well formed as the page contains formatted text and
might miss some of the closing tags. Is there a better way to get rid
of the input hidden form level viewstate ( ID = "__VIEWSTATE") ?

Thanks,
Sam.

You'll probably run into problems trying to get a XML compliant document
from a HTML page unless you go out of your way to make the page compliant.

If you really need to eliminate the viewstate you could use a regular
expression to find and remove it.
--
Bits.Bytes
http://bytes.thinkersroom.com
Jan 3 '07 #5
"bruce barker" <no****@nospam.comwrote in message
news:Ou**************@TK2MSFTNGP03.phx.gbl...
as you don't care about postback just add to your page:

// override standard viewstate handler with do nothing
protected override void SavePageStateToPersistenceMedium(Object state)
{
}
Yes, but that still leaves the hidden controls which the OP wants removed,
for some reason...
Jan 3 '07 #6
do this using a response filter + regex

Gerry
<sr*****@mailcity.comwrote in message
news:11********************@i12g2000cwa.googlegrou ps.com...
Hello,
I have a aspx page in which I would like to eliminate all of
the hidden variables as this page would be imported to an email client
and the hidden controls are usually rendered in the mail client. The
asp.net form does have the form input hidden control inspite the
viewstate is disabled at the page level. Isnt there a way to eliminate
it? And, as per my understanding, it just cant be eliminated. Now, I
was trying to parse the page treating it as a XML doc and remove the
hidden control. The problem there would be - there is no guarantee that
the XML document is well formed as the page contains formatted text and
might miss some of the closing tags. Is there a better way to get rid
of the input hidden form level viewstate ( ID = "__VIEWSTATE") ?

Thanks,
Sam.

Jan 3 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2653
by: Homa | last post by:
Hi, I have a datalist with linkbuttons embedded within. In order for the onClick event to fire, I need to have EnableViewState = true. But since there are quite a lot of data, simply enable...
1
1143
by: Jeff S | last post by:
I'm trying to optimize performance of a few pages. Toward this result, I have done the following: 1. set EnableViewState="false" and EnableSessionState="false" in the @ Page directive. 2. set...
1
438
by: Rhodri | last post by:
Hi all I have a datagrid which can display upto 20,000 records and the viewstate gets very big. I have tried turning of viewtate using EnableViewState = false both on the parent page and on the...
3
1245
by: Stan | last post by:
Dispite the fact that ViewState="false" at the page level, and all controls have viewstate disabled, ViewState is still on the page (<input type="hidden" name="__VIEWSTATE" value="..." /> Why...
2
5907
by: Fluxray | last post by:
--Background: I have a webform including a datagrid. The datagrid is using template. Its ItemTemplate is used to display a look-up-table with labels. its EditItemTemplate is used to edit a row in...
2
2170
by: Jonathan Folland | last post by:
I have been working on this most of the day and cannot find a solution to my problem. I have an application where I may not actually have a page. for example a user may make a request for...
4
1869
by: Umut Tezduyar | last post by:
I want to get rid of the hidden field _VIEWSTATE. I tried these: I tried to disable ViewState property. I tried to override Page's RegisterHiddenField method. I tried to override Page's...
7
2110
by: George Ter-Saakov | last post by:
on my page I have <%@ Page Language="C#" EnableViewState="false"%> But in HTML i still see __VIEWSTATE hidden variable. <form name="form1" method="post" action="......" id="form1"> <div>...
4
2275
by: =?Utf-8?B?TUNN?= | last post by:
I am trying to disable ViewState at the application level. I have the following line in my web.config: <pages enableViewState="false"></pages> But it is not working. What can I do?
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7347
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7416
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7073
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5656
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4732
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
779
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.