Forum Moderators: open

Message Too Old, No Replies

ugh. viewstate and webresources.axd

viewstate and webresources.axd problems

         

ctudorprice

2:34 pm on May 23, 2006 (gmt 0)

10+ Year Member



I'm on .net 2.0 and am trying to move viewstate to the bottom of the page (like DNN and others do) so that Google etc don't see 10k of viewstate rubbish before getting to my content. I have a httphandler that does moves viewstate to right before the /form tag at the bottom and works admirably except I get errors on a couple of pages where asp.net inserts a reference to webresources.axd (which is really just a generated javascript file) right under the viewstate. The message is that webform_postbackoptions is invalid. When I remove the httphandler, it works again so it clearly has something to do with moving viewstate around. But I still need to move viewstate.
Jeez, we need a site dedicated to working with asp.net and making it SE friendly.... great development tool unless you use its features. :)

Anyone else run into this?

oxbaker

3:22 pm on May 23, 2006 (gmt 0)

10+ Year Member



have you tried moving the .axd reference below the viewstate as well? See if you can get the js to inject itself as the last item in right before </form> and hopefully viewstate will be above it.

hth,
mcm

ctudorprice

3:45 pm on May 23, 2006 (gmt 0)

10+ Year Member



Yes, I tried that. I moved the

<script src="/WebResource.axd?blahblah" type="text/javascript"></script>

block to below viewstate but that didn't do the job either, then I tried taking everything in the div (including the eventtarget, eventargument, viewstate and the aspnetform scripts) but that didn't seem to work either.
I've seen various posts where DotNetNuke users have complained of the same messages (DNN also moves viewstate to end) but I can't figure out what their resolution (if there is one) has been.

The only thing that I can think to start tinkering with is the encoding part of my moveviewstate function which applies utf-8 encoding... grasping at straws.

oxbaker

4:14 pm on May 23, 2006 (gmt 0)

10+ Year Member



did you read this thread? may help:
[experts-exchange.com...]

ctudorprice

7:46 pm on May 23, 2006 (gmt 0)

10+ Year Member



I found it... it appears that the problem relates to a conversion to UTF8 that the code I was using did. I got the code from here:
[structured-solutions.net...] - bad, bad, bad, - don't use it. Not totally clear why but the coversion from bytes() to UTF8 causing a problem somewhere.

If anyone else tries to move viewstate, use the elegant method that DNN uses:

[webmasterworld.com...]

or download the source at [dotnetnuke.com...] and look in components\basepage.vb.

Ugh - a day wasted. Thanks for your help/commiseration.

oxbaker

8:27 pm on May 23, 2006 (gmt 0)

10+ Year Member



yup. :( i thought these kind of bugs were reserved for Macromedia products ;)