User Tools

Site Tools


dump_the_session_variable

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

Or try this:

' Dump the session variable
Debug.WriteLine("****************** " + Now().ToShortDateString() + " " + Now().ToShortTimeString() + " ******************")
Debug.Indent()
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
		Debug.WriteLine("Session(""" + key + """) as " + type + " : " + CType(Session.Item(i), String))
	Else
		Debug.WriteLine("Session(""" + key + """) as " + type)
	End If
Next
Debug.Unindent()
Debug.Flush()
dump_the_session_variable.txt · Last modified: 2017/01/01 08:05 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki