While working on an ASP.NET forms application I ran into one big problem that was hurting SEO. The viewstate for one of the pages in the application was ballooning out of control. This page in question was very important landing page in the application and thus needed the best SEO optimization we could offer.
Now you might be wondering what viewstate has to do with the SEO value of a page, you may be surprised by the answers. First of all an out of control viewstate causes the page size to increase dramatically. This will increase the time it takes to download the page, which is something most search engines will use to rank a page.
Secondly, search engines will give priority to content based on how close to the beginning of the body it is. In cases where you have a large viewstate it will push the content you want the search engine to see further down the page and put it at risk at not even being seen at all.
If you don’t care about SEO value on a page then viewstate doesn’t matter other than it increasing page size. But if you do care about SEO then it is important to manage your viewstate better and keep it under control. In order to take control of your viewstate and increase a page’s SEO value there are a several things you can do.
The best thing you could do to avoid viewstate problems would be to write your application as MVC and get away from ASP.NET Forms and viewstate itself. However, since that would require a rewrite for existing applications it’s not a very good option. But if you are starting an application from scratch with SEO in mind it is important factor to consider.
If you can’t rewrite your application then you do have other options. You can turn viewstate off entirely on the page or you can turn it off on individual controls that are causing the size explosion. Most often these offending controls are data controls. You can also enable ASP.NET tracing which will give you detailed information on each control’s viewstate footprint.
Be careful when disabling viewstate though. When viewstate is enabled on a control it keeps track of what items/content are in that control. So when you disable it on each postback that information will be lost if you don’t repopulate it.
Other ways to ease the burden of a large viewstate are compression, better utilization and smaller data sets/classes. Whatever the way you choose keep viewstate in mind when building an ASP.NET application where SEO value is important.