Followup. It is my recommendation to anyone developing ASP.NET 1.1 not to
use Publuc Variables in Public Modules and specifically not to use them in
conjunction with session variables. Data persists from on persons session
to anothers and I had sessions overwriting each others data. The code to
duplicate this persistence is quite simple and is attached below (Special
Thanks to KJ for posting the code to duplicate). An interesting side point
is if you were wanting to share data between different users then this would
be a quick and fast way of doing it at the application level since you would
not have to redim or reload the data before using it. Everyone is pointing
to the same point in memory and the pointer stays across sessions. I can
see a use for it in gaming environments already.
*** code follows ***
' Module code
Module TestModule1
Public GlobalSettingsInstance As New GlobalSettings
End Module
Public Class GlobalSettings
Public Int1 As Int32 = Int32.MinValue
End Class
'aspx #1
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
GlobalSettingsInstance.Int1 = 567
'Session("GSI") = GlobalSettingsInstance 'tried with this commented
and uncommented
End Sub
Private Sub lbtnGoToPage2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles lbtnGoToPage2.Click
Response.Redirect("TestPage2.aspx", False)
End Sub
'aspx #2
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Response.Write("Hello World") 'breakpoint here reveals .Int1 member =
567, regardless of session call in aspx #1
End Sub