Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Determine a session variable type

Reply
Thread Tools

Determine a session variable type

 
 
tshad
Guest
Posts: n/a
 
      02-20-2006
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


 
Reply With Quote
 
 
 
 
=?Utf-8?B?YnJpYW5zW01DU0Rd?=
Guest
Posts: n/a
 
      02-20-2006
Hello Tshad,

I would think you could use Session["var1"].GetType()
or Session.Contents["var1"].GetType();
--
brians
http://www.limbertech.com


"tshad" wrote:

> 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
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine if a Session Variable exists? Shapper ASP .Net 4 09-21-2011 04:35 AM
System Session Variable VS. Own-declared 'Session' Variable chowchho ASP .Net 7 03-28-2008 02:38 PM
Determine type of a variable whose value is NULL brian.vanheesch@gmail.com Java 3 09-15-2007 07:23 PM
determine variable type MCollins@seminolecountyfl.gov Python 4 08-19-2005 03:28 PM
Way to determine type of variable? Walter L. Preuninger II C Programming 21 07-17-2004 03:04 PM



Advertisments