Hello,
We have a DNN website with community version. We are getting a very big View State in DNN page, and this is not good for SEO(Search Engine Optimization).
So to remove viewstate at the bottom of page I added render method in Default.aspx.vb in my DNN website as following :
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Dim stringWriter As New System.IO.StringWriter()
Dim htmlWriter As New HtmlTextWriter(stringWriter)
MyBase.Render(htmlWriter)
Dim html As String = stringWriter.ToString()
Dim StartPoint As Integer = html.IndexOf("<input type=""hidden"" name=""__VIEWSTATE""")
If StartPoint >= 0 Then
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)
End If
End If
writer.Write(html)
''MyBase.Render(writer)
End Sub
With this change I am getting the view state at the bottom of the page. But now in Admin/host mode "Control Panel" of DNN is not working.
And I am not getting options of adding page, adding modules to a page, etc..
Can anyone please help on this.
Thanks and Regards,
Ashish Shukla