Hello all. I am converting an intranet site from asp classic to asp.net. I'm looking for opinions about how to pass the same variables to different class modules. In classic asp we have many variables describing a user, such as logon, department, division, etc... These are Dim'd at the top of every .asp page. These variables are used in about every asp class module that is called. The scope of these variables are global even to the class modules (although, that's not the best programming style). Well, with .net, the scope of these variables change, and I need to declare them in every class module where they are used. I'm trying to find a way around this. Here are my options and brilliant ideas (sarcasm intended):
1) Put all these values in session variables. (I'm avoiding this like the plague as session variables take up memory and resources.)
2) Re-read the database in every class module to get the information. (I'm also trying to avoid database calls!)
3) Create a hash table that can be read by everyone and only extract that person's row. Since I specified "Shared", the hash table would be shared by all sessions and all users, so I would have to exract the persons information like this:
strUser = hshUsers.Item("logonid"
I would have to delete the entry in the Session_End sub when the user is finished. Basically, the hash table would be defined like this:
Public Shared hshUsers As New Hashtable()
Structure structUserVars
Dim strLogonID as String
Dim lngDeptCode as Long
Dim lngDivCode as Long
..etc..
End Structure
4) Is there another way to share variable in the same session besides these methods?
Does all of this remotely make sense?
What do you think is the best and most efficient way to do this? Your opinions are certainly appreciated!
Thanks for reading this looong message!
Steve
sms@hmbnet.com
1) Put all these values in session variables. (I'm avoiding this like the plague as session variables take up memory and resources.)
2) Re-read the database in every class module to get the information. (I'm also trying to avoid database calls!)
3) Create a hash table that can be read by everyone and only extract that person's row. Since I specified "Shared", the hash table would be shared by all sessions and all users, so I would have to exract the persons information like this:
strUser = hshUsers.Item("logonid"
I would have to delete the entry in the Session_End sub when the user is finished. Basically, the hash table would be defined like this:
Public Shared hshUsers As New Hashtable()
Structure structUserVars
Dim strLogonID as String
Dim lngDeptCode as Long
Dim lngDivCode as Long
..etc..
End Structure
4) Is there another way to share variable in the same session besides these methods?
Does all of this remotely make sense?
What do you think is the best and most efficient way to do this? Your opinions are certainly appreciated!
Thanks for reading this looong message!
Steve
sms@hmbnet.com