Welcome to WebmasterWorld Guest from 188.8.131.52
Forum Moderators: ocean10000
It is an open-source project so you could look through the code to see how they do it...or ask in the forums at the ASP.Net website...there is a DNN section there.
' This method overrides the Render() method for the page and moves the ViewState
' from its default location at the top of the page to the bottom of the page. This
' results in better search engine spidering.
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Dim stringWriter As System.IO.StringWriter = New System.IO.StringWriter
Dim htmlWriter As HtmlTextWriter = New HtmlTextWriter(stringWriter)
Dim html As String = stringWriter.ToString()
Dim StartPoint As Integer = html.IndexOf("<input type=""hidden"" name=""__VIEWSTATE""")
If StartPoint >= 0 Then 'does __VIEWSTATE exist?
Dim EndPoint As Integer = html.IndexOf("/>", StartPoint) + 2
Dim ViewStateInput As String = html.Substring(StartPoint, EndPoint - StartPoint)
html = html.Remove(StartPoint, EndPoint - StartPoint)
Dim FormEndStart As Integer = html.IndexOf("</form>") - 1
If FormEndStart >= 0 Then
html = html.Insert(FormEndStart, ViewStateInput)
I've not seen any posts that show evidence of this being bad for SEO. Has anyone?
If your not using server side controls or binding you can remove the runat=server tag from the form... that will remove the viewstate field.
Thanks TheNige, I'll look into this.
If you have few or no Session objects when the visitor first lands on the site when the spider hits the money pages it never sees a real long string like a customer would shopping around the site and adding items into their cart, generating cookie content, entering data into forms, etc.
(2) Viewstate is automatically enabled on all controls you stick on your form, and in most cases you don't need it enabled, so you should go around turning it off where it's not needed. This probably won't help your SEO that much, but it will save you bandwidth and help the pages load faster.
The core teams are all very good programmers and the Community Server Forums even helped influence some features that are going to be in ASP 2.0
Do searches on them in Google.