|
-
Mar 31st, 2005, 04:12 AM
#1
Thread Starter
Hyperactive Member
Maintain Variable Values
I'm sure this is a stupid question, but I still need the answer.
I want to be able to populate a DataSet the first time an aspx page loads and have that DataSet available for future loads.
Declaring the DataSet as static won't work because, as I've mentioned in another thread, static makes the variable shared between all sessions, so each session will not have a unique copy of the DataSet.
Any ideas?
-
Mar 31st, 2005, 04:33 AM
#2
Retired VBF Adm1nistrator
Re: Maintain Variable Values
Store it in the Application object with a key reference to a Session ID. You could store it in the Session object much easier, but, if you do so then it will be serialized and sent back to the client on each request. So if its a big dataset that would be a pain in the ass.
One could also store a static array of DataSets, and refer to each by Session ID index...
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Mar 31st, 2005, 04:42 AM
#3
Re: Maintain Variable Values
How about Caching the dataset object?
-
Mar 31st, 2005, 04:53 AM
#4
Thread Starter
Hyperactive Member
Re: Maintain Variable Values
 Originally Posted by plenderj
You could store it in the Session object much easier, but, if you do so then it will be serialized and sent back to the client on each request. So if its a big dataset that would be a pain in the ass.
Why would a DataSet be sent to the client?
There is no need for it, or are all Session variables sent?
If they are why?
I thought Session variables stayed on the server and were associated with an active Session.
-
Mar 31st, 2005, 05:41 AM
#5
Re: Maintain Variable Values
 Originally Posted by GlenW
Why would a DataSet be sent to the client?
There is no need for it, or are all Session variables sent?
If they are why?
I thought Session variables stayed on the server and were associated with an active Session.
If I'm not mistaken, the Session ID only is sent to the client, and sent back to the server to identify the session information associated with that current browser session.
That all said, if the dataset you're storing in your session object is large, it's going to take quite a bit of server resources. Not good, especially if you're doing this for thousands of users!
That's why I had suggested caching the object. Btw, I'm not even sure if this dataset you want stored will be accessible to all users or just to one user.
-
Mar 31st, 2005, 05:47 AM
#6
Re: Maintain Variable Values
You also mentioned that the dataset should be available for future loads. Sessions end after a certain timeout periiod.
-
Mar 31st, 2005, 05:51 AM
#7
Thread Starter
Hyperactive Member
Re: Maintain Variable Values
 Originally Posted by mendhak
If I'm not mistaken, the Session ID only is sent to the client, and sent back to the server to identify the session information associated with that current browser session.
That's what I thought.
 Originally Posted by mendhak
That all said, if the dataset you're storing in your session object is large, it's going to take quite a bit of server resources. Not good, especially if you're doing this for thousands of users!
The DataSets may be large but the application is for intranet use with a very limited number of users, so that should not be a problem.
-
Mar 31st, 2005, 06:01 AM
#8
Retired VBF Adm1nistrator
Re: Maintain Variable Values
Everything you insert into a Session object is serialised, Base64 encoded, and sent to the client in the VIEWSTRING. Take a look at the source code of html pages and you'll see sometimes it can get really really big.
Personally I would assign a SessionID to people. Then store all object in the Application object or whatever and list by SessionID...
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Mar 31st, 2005, 06:18 AM
#9
Thread Starter
Hyperactive Member
Re: Maintain Variable Values
 Originally Posted by plenderj
Everything you insert into a Session object is serialised, Base64 encoded, and sent to the client in the VIEWSTRING.
No it isn't.
Session objects are held on the server.
The _VIEWSTATE holds values for controls on the page that have their EnableViewState property set to true, the default, and any ViewState variables you create.
-
Mar 31st, 2005, 08:53 AM
#10
Retired VBF Adm1nistrator
Re: Maintain Variable Values
I have absolutely no idea why I wrote that
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Mar 31st, 2005, 09:03 AM
#11
Thread Starter
Hyperactive Member
Re: Maintain Variable Values
 Originally Posted by plenderj
I have absolutely no idea why I wrote that 
I've felt like that before, like when I said "Will you marry me?" and "'course I meant it".
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|