468,140 Members | 1,452 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,140 developers. It's quick & easy.

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 1763
<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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Homa | last post: by
1 post views Thread by Rhodri | last post: by
3 posts views Thread by Stan | last post: by
2 posts views Thread by Jonathan Folland | last post: by
7 posts views Thread by George Ter-Saakov | last post: by
4 posts views Thread by =?Utf-8?B?TUNN?= | last post: by
27 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.