The said:
In a .vb class function, can I assign user-specific information (e.g.
First Name, Role, etc.) to local variables (as opposed to referring to
the session variable multiple times)?
Yes, that would a be Best Practice. Using local variables avoids the
overhead of multiple accesses of the session object as well as the type
conversions involved. I've started following this pattern in my classes:
....
private _cachedobject as some_object
private/public/protected CachedObject() as some_object
Get
if _cachedobject is nothing then
'retrieve the object from cache/session/application
'and set the retrieved object to _cachedobject
'assuming session:
if not Session("CachedObject") is nothing then
_cachedobject=ctype(Session("CachedObject"), _
some_object)
end if
end if
return _cachedobject
End Get
Set (ByVal Value as some_object)
_cachedobject=value
'add Value to cache/session/application
End Set
End Property
....
public function MyFunction() as something
dim obj as some_object = Me.CachedObject
...
end function