Determine a session variable type

T

tshad

I have some code to go through a session collection for my error page
routine and I get an error on my objects that I store in session variables.

Dim strName as String
Dim iLoop as Integer

For Each strName in Session.Contents
trace.warn(strName & " - " & Session.Contents(strName))
Next

How do I determine what the variable type of each session variable is? I
get an error if I try to print the contents of a non-scalar object (of
course).

In a trace window MS lists the type and the value. If not a scalar type it
just puts the variable type in the value field. Such as:

EmailHtml System.Boolean False
CompanyID System.Int64 1000
User RolesBasedAuthentication.User
RolesBasedAuthentication.User

I need to do something like this.

Thanks,

Tom
 
G

Guest

Hello Tshad,

I would think you could use Session["var1"].GetType()
or Session.Contents["var1"].GetType();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top