PC Review


Reply
Thread Tools Rate Thread

Completely disable viewstate

 
 
sri_san@mailcity.com
Guest
Posts: n/a
 
      3rd Jan 2007
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.

 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      3rd Jan 2007
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> And, as per my understanding, it just cant be eliminated.


I believe you are correct...


 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      3rd Jan 2007
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)

(E-Mail Removed) 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.
>

 
Reply With Quote
 
Rad [Visual C# MVP]
Guest
Posts: n/a
 
      3rd Jan 2007
On 3 Jan 2007 07:48:00 -0800, (E-Mail Removed) 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
 
Reply With Quote
 
sri_san@mailcity.com
Guest
Posts: n/a
 
      3rd Jan 2007
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, (E-Mail Removed) 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


 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      3rd Jan 2007
"bruce barker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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...


 
Reply With Quote
 
gerry
Guest
Posts: n/a
 
      3rd Jan 2007
do this using a response filter + regex

Gerry


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable Viewstate MCM Microsoft ASP .NET 26 2nd Oct 2009 02:22 AM
Disable ViewState MCM Microsoft Dot NET 4 16th Sep 2008 06:00 AM
disable ViewState ? George Ter-Saakov Microsoft ASP .NET 7 20th Jan 2007 10:34 PM
Disable ViewState Julien Grossiord Microsoft ASP .NET 1 23rd Nov 2005 06:22 PM
ViewState Size Reduced, but not Completely Empty Jeff S Microsoft ASP .NET 1 20th Jan 2004 01:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:10 PM.