User Tools

Site Tools


dump_the_session_variable

This is an old revision of the document!


Dump the Session Variable

' Dump the session variable
Dim file As New System.IO.StreamWriter("c:\temp\Session Dump.txt", True)
Try
	Dim i As Integer
	Dim key, type As String
	file.WriteLine("****************** " + Now().ToShortDateString() + " " + Now().ToShortTimeString() + " ******************")
	For i = 0 To Session.Keys.Count - 1
		key = Session.Keys.Item(i)
		If Session.Item(i) Is Nothing Then
			type = "(Null)"
		Else
			type = Session.Item(i).GetType().ToString()
		End If
		If type.StartsWith("System.String") Or type.StartsWith("System.Int") Or type.StartsWith("System.Boolean") Then
			file.WriteLine("Session(""" + key + """) as " + type + " : " + CType(Session.Item(i), String))
		Else
			file.WriteLine("Session(""" + key + """) as " + type)
		End If
	Next
Finally
	file.Close()
End Try
dump_the_session_variable.1231977107.txt.gz · Last modified: 2017/01/01 19:49 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki