2

I have some large controls that are swelling my ViewState to 10KB+. Ignoring the discussion about using alternatives to ViewState, I'm trying to minimize any impact my ViewState might have on SEO. Here's what my research has lead me to believe:

  • A lot of developers like to move ViewState to the bottom of the page by overriding Page.Render. At first glance, this works great but some people experience problems when their site is under load, or if a user gets an itchy trigger finger and submits a form before the page is done rendering (before the ViewState is in place). There are enough question marks here that I want to avoid this technique.

  • You can check if the UserAgent is a crawler (through various methods) and simply disable ViewState when you're not dealing with a real user. This also appears to do the trick (and in 3 lines of code), but some people are concerned that this is cloaking, and could actually do more harm than good to your SEO. While the intent in this case is obviously not cloaking, the result does render out significantly less KB to crawlers than to actual users and I can see the potential for automated red flags.

I'm not satisfied with either scenario, and I'm not able to find anything more on the topic. My potential solution is to combine the techniques by moving the ViewState to the bottom of the page only when the UserAgent is a crawler.

  • The crawler doesn't use the ViewState anyway, so the potential pitfalls of moving the ViewState to the bottom don't apply.

  • The same content gets delivered to crawlers and real users, albeit in a different order.

  • The crawler sees all my juicy keywords right there in the first few KB of the page.

I was hoping that I could get some feedback on this technique, especially the following:

  • Could this still be considered cloaking?

  • Are there any potential issues with this approach?

  • Am I overthinking it? Is there an easier approach that I wasn't able to find through Google?

2 Answers 2

1

Hiding ViewState is unlikely to be seen as cloaking, as ViewState wouldn't be seen as content.

What exactly are your concerns with ViewState? If you are worried about the page speed then "cloaking" will not help you anyway. PageSpeed is measured by real visitors to your site who have the Google Toolbar.

So my suggestion would be either to get rid of ViewState entirely, or simply not worry about it and work on other issues like HTTP requests, making sure everything is gzipped, and cutting down on image size.

3
  • It's just 10KB+ of data above the actual content of my site. I'm concerned that my actual content will be weighted lower by being 'further' down the page. Google PROBABLY takes viewstate into account, but there's no way to know for sure.
    – Stephen
    Commented May 26, 2013 at 20:59
  • That should not be an issue either. Like I said, ViewState would not be seen as content (IIRC it's a meta tag or at least, just an attribute value on some other tag) so your content is still the first thing Googlebot sees and it not "pushed down". Commented May 27, 2013 at 14:39
  • ViewState is a hidden input field. I definitely agree with you - but I can't find anywhere that Google explicitly says it will ignore the values of hidden fields. And there's quite a few websites out there detailing how to move your ViewState to the bottom of the page, so at least some people are concerned about the potential impact. So, I figure moving it to the bottom of the page for crawlers can't hurt. Thank you for the discussion!
    – Stephen
    Commented May 27, 2013 at 19:02
0

I wasn't familiar with what "ViewState" is. It appears to be form data used by ASP.net to save user submitted data after a form is submitted in the case that there is an error message so that the form can be re-displayed without the user losing their data.

Since you don't need ViewState until after a form is submitted, I'd recommend not displaying it at all to any user agent until after a form is submitted. That way crawlers generally will never see it and users won't get it until they need it.

1
  • I'm fairly sure asp.net requires ViewState to be present before you submit any form. Commented May 27, 2013 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.