Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
'Get the viewstate object
Dim obj As Object = HttpContext.Current.Request("__VIEWSTATE")
If IsNothing(obj) Then
'Add to trace
HttpContext.Current.Trace.Warn("ViewState Size", "0")
'Print the out put
Debug.WriteLine("ViewState Size is 0”)
Else
' Add to trace
HttpContext.Current.Trace.Warn("ViewState Size",
Request("__VIEWSTATE").Length.ToString())
'Print the out put
Debug.WriteLine(Request("__VIEWSTATE").Length.ToString())
End If
End Sub