Answers

Jul 12, 2006 - 07:23 PM
First of all, what programming language do you use? .Net? Java? What environment? ASP?
I can give you an answer for .Net. You have three areas in .Net where you can save information: Viewstate, Session State and Application state. Depending on where and how you want to use the information you select the correct area.
Viewstate:
information is available for the same webpage. Example, you load data into a drop down field and want to load it only once for this page. You enable viewstate for the drop down component and it keeps the data between posts
Session state:
you want to have data available for the same session but across different web pages/forms. You can save almost anything which is serializable to Session state. And session state can be held in memory of the web server, on another state server or even in a database. Key is the session ID
You create a new entry in session state in C# with:
String[] MyArray;
//Fill array or do something
Session["MyArray"] = MyArray;
You retrieve Session state data with
AnotherArray = Session["MyArray"];
Application state:
If you want to make data available across sessions. I.e. global data for every user!
Note, Application State has to be initialized before you can use it. Best place to do thi sin an ASP.Net app is in the ApplicationStart Event.
You create Application state with
Application["AppCount"] = 0;
You can then use Application["AppCount'} on every page in this application. Across sessions and users!
Let me know if you need more information
Cheers
Peter
I can give you an answer for .Net. You have three areas in .Net where you can save information: Viewstate, Session State and Application state. Depending on where and how you want to use the information you select the correct area.
Viewstate:
information is available for the same webpage. Example, you load data into a drop down field and want to load it only once for this page. You enable viewstate for the drop down component and it keeps the data between posts
Session state:
you want to have data available for the same session but across different web pages/forms. You can save almost anything which is serializable to Session state. And session state can be held in memory of the web server, on another state server or even in a database. Key is the session ID
You create a new entry in session state in C# with:
String[] MyArray;
//Fill array or do something
Session["MyArray"] = MyArray;
You retrieve Session state data with
AnotherArray = Session["MyArray"];
Application state:
If you want to make data available across sessions. I.e. global data for every user!
Note, Application State has to be initialized before you can use it. Best place to do thi sin an ASP.Net app is in the ApplicationStart Event.
You create Application state with
Application["AppCount"] = 0;
You can then use Application["AppCount'} on every page in this application. Across sessions and users!
Let me know if you need more information
Cheers
Peter

Jul 14, 2006 - 11:23 AM
Thanks Pete. I happened to have bumped into the solution yesterday, that i could use ASP.NET's Session[] class to store my arraylists and retrieve them by casting the Session variable as an arraylist. It works now. However have you tried using the HttpCookies class? It seems that b'cos of the size limitation imposed when using client cookies, Errors are flagged when you try to store a cookie with the HttpCookie class. I could be wrong, but that's my observation. Anyway lessons learned and Thanks a lot for the help.
Add New Comment