Wednesday, 27 June 2012

Remove ViewState from ASPX Page.



Just Copy/Paster following Code in your Code.
 
Protected Overrides Function LoadPageStateFromPersistenceMedium() As Object
        Return (New LosFormatter().Deserialize(DirectCast(Session("ViewState"), String)))
    End Function

    Protected Overrides Sub SavePageStateToPersistenceMedium(ByVal state As Object)
        Dim los As New System.Web.UI.LosFormatter()
        Dim sw As New System.IO.StringWriter()
        los.Serialize(sw, state)
        Dim vs As String = sw.ToString()
        Session("ViewState") = Nothing
        Session("ViewState") = vs
    End Sub

No comments:

Post a comment