Consider the following code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init If Page.IsPostBack Then If ViewState('test') IsNot Nothing Then Response.Write((ViewState('test').ToString)) Else Response.Write('Viewstate is empty.') End If Else ViewState('test') = 'viewstate is working.' End If End Sub
This code doesn’t work on a particular page in my application. Viewstate is not turned off in the Page directive. I can’t figure out what’s going on. : \
Oh i just figured it out. See if you notice it.
.<
Figured it out, someone had changed the Page_Load event to handle Page.Init