State Management :: Memory Size Of Session / ArrayList?

Apr 24, 2010

I am using ASP.NET 2.0.

In my applicaion, I store some values in an ArrayList and store this Arraylist in a session variable. I want to know the size of this session variable in memory. Is there any method to do this.

View 6 Replies

Similar Messages:

State Management :: Accessing Session Arraylist

Jul 13, 2010

I am using a Session Arraylist to hold information about an online user. However, I am having troubel accessing the data. The error seems to be in the last bit because I can access one value of sample data just not print out a number of values. I have an class penalyPoint that has the following constructor:

public PenaltyPoint(string penaltyCode1, string penaltyDate1, string PenaltyPointsAwarded1, string penaltyBan1)

Then in a button response I have the following response which holds the data in a session arraylist variable as the user can enter a number of these objects. I will put a capacity limit on the arraylist later on.

//Assign the data in the form to a PenaltyPoint Object
PenaltyPoint penPoint = new PenaltyPoint(ddlPen1Code.SelectedValue, txtPenDate.Text, txtPen1Points.Text, txtPen1Ban.Text);
//The current driver number has to be set before this page is called
int currentDriver = 0;
//int currentDriver = (int)(Session["currentDriverNum"]);
//create an arraylist to be used for transferring arraylist to session
ArrayList penPointsDrive0Array = new ArrayList();
if (currentDriver == 0)
//if the session is equal to null then nothing has to be returned from session
if (Session["penPointsArrayListDrive0"] == null)
Session["penPointsArrayListDrive0"] = penPointsDrive0Array;
penPointsDrive0Array = (ArrayList)Session["penPointsArrayListDrive0"];
Session["penPointsArrayListDrive0"] = penPointsDrive0Array;

Then I try to access the data in the arraylist but I getting nothing printing out. I am just trying to test the data at the minute. I am not that use to arraylist so this might be the problem.

public partial class TestPage : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
ArrayList answer = new ArrayList();
ArrayList driver1 = (ArrayList)Session["penPointsArrayListDrive0"];
PenaltyPoint ps = new PenaltyPoint();
string output;
for (int i = 0; i < driver1.Count; i++)
ps = (PenaltyPoint)driver1[i];
string answertemp = ps.getPenaltyCode();
output = answertemp;

I can't get the final part to collect all the values into a string it keeps on coming up with errors.

View 2 Replies

State Management :: Store An ArrayList Into A Session Variable?

Apr 23, 2010

I'm looking store an ArrayList into a session variable, but am having a few problems. Can you spot anything wrong?

public partial class _Default : System.Web.UI.Page { ArrayList score = new ArrayList(); protected void twist2(object sender, EventArgs e) { int a = 11; int c = RandomNumber(a); score.Add(c); score = (ArrayList)Session["scoreData"]; Result.Text = (c).ToString(); String Result_id = Result.Text; int total = 0; //Session["scoreData"] = score; for (int i = 0; i < score.Count; ++i) { total += (int)score[i]; } Sum.Text = (total).ToString(); String Sum_id = Sum.Text; }

View 3 Replies

State Management :: Find Out The Size Of The Session?

Dec 2, 2010

I am storing some controls (say Textbox with filled values) in a Session. I need to find out the size of the session. Can I achieve this?

View 4 Replies

State Management :: Multidimentional Arraylist / Create A Arraylist Which Will Able To Store User Info?

Jul 16, 2010

i want to create a arraylist which will able to store user info like (username,machineIP,port ) for each user in the list & retrive this data when needed . any one tell me how i can do it or any alternative way without database or xml file.

View 6 Replies

State Management :: Memory Management - SessionState Collection

May 5, 2010

I have a problem regarding the SessionState Collection.I retrieve an object


I thought that i access a reference type. But calling the default constructor to build a new object seems not to work.The next time I access the object I still get the old one.

View 2 Replies

Session State ArrayList In Shopping Cart?

May 1, 2010

I'm creating a shopping cart application and I'm having some issues with implementing a session state for my arraylist.

in my page load i declared

if (Session["Cart"] == null)
Session["Cart"] = new ArrayList();
ArrayList cart = (ArrayList)Session["Cart"];

to create the session if it doesn't exist yet.
then i have an event handler for a button to add items to the arraylist

protected void onClick_AddBooking(object sender, EventArgs e)
int ClassID = Convert.ToInt32(Request.QueryString.Get("Class_Id"));
ArrayList cart1 = new ArrayList();
cart1 = Session["Cart"];

I'm essentially storing the class_ID then when the student confirms i'll store that to the DB and associate that ID with the Class Details.

View 1 Replies

State Management :: Maximum Size Of View State?

Oct 6, 2010

What is the maximum size of view state?

View 4 Replies

State Management :: Error :Session State Has Created A Session Id, But Cannot Save It?

Nov 18, 2010

I read the solutioin for this error, at the following link : I am still not clear what exactly causes the error. I have two doubts :1. Can anyone please elaborate a bit on this issue, with any example ????2. Is there any drawback of this approach ?

View 4 Replies

State Management :: Multiple DataTables In Memory - Best Practice?

Jul 9, 2010

I have a DataTable which holds information on truck routes. When the user click on a route it display another table with details about the stop along that route. When they click a stop it shows what items were picked up at that stop. Three separate pages with 3 distinct DataTables. Currently I am storing them in the session. Normally, I would use the view state since the data only needs to live on that page. The reason I use the session is because each page is part of a Master pagelayout. There is an export button in the master page which gets the data in the session and exports it to an excel file. The issue is that when the user goes to the item level detail and uses a quick navigation link back to the route information the data for route is not reloaded into the session, just the page. If the user clicks export it will export the data set from the item level detail even though it is not displayed on the page

View 4 Replies

State Management :: Putting Lookup Tables In Memory?

Sep 17, 2010

How is the best way of putting a lookup table in memory for use though my ASP.NET app? Should I do this in the Global.asax's Application_Start event and keep in Session?

View 6 Replies

State Management :: Deleting Data In Cache Memory?

Mar 4, 2011

I have a webpage which displays some data along with a banner. The banner image is stored in the database with parameters "Pagename" and "form".

The application has been coded in such a way that when the page loads , a function checks for the banner in cache memory first with the parameters "pagename" and "form". It the banner does not exist, the new banner is retrieved from the database and is added to the cache memory. Next time when the same page is called, the banner is displayed from the cache memory avoiding the DB to be hit everything to get the banner.

Now, I do not want a specific banner to be displayed on the page. I have removed that banner from the DB but the banner still gets displayed as this banner is still there in the cache memory.

Is there any way to delete the banner which exists in cache memory without making any code changes?

View 5 Replies

State Management :: Viewstate Size Too Heavy (Around 2MB)

Sep 16, 2010

I am developing a a web application of a general store where the operator has to enter the things what customer has purchased. Like daily usage item,or anything. So I have form in which I first ask how much item u wannt to register...(if he has 20-30 number of items then operator will enter 20-30 then in gridview 20-30 item are opened. With bind dropdownbox containing name of item ,then textboxs containing mrp, value, stock avail of that item. Here is the link for demo. [URL]. Problem is suppose the operator enter the value above 20, then viewstate size id about 1.50Mb that's too heavy.

Here is .cs code

View 1 Replies

State Management :: Increase The HTML Page Size?

May 4, 2010

When I look on the html I have something like below, this increase the HTML page size. how do I remove this (performance issue):


View 2 Replies

Web Forms :: Caching When Cached Size Exceed Memory Size?

Nov 29, 2010

As I know, by default Cache is stored in the memory and to the disk at the same time DiskCacheable=true).When the cached response is removed from the output cache due to memory pressure, it still remains on disk allowing a much larger set of pages to be cached. In addition, disk cached pages survive application restarts. And this is already in ASP.NET 2.0.I dont't know in which order the caches are removed from the memory and readen from disk instead? I would like to achive, that caches with the minimal trafic, or the longest last used, would be removed first from the memory. Is there some settings to do that, or even by default works that way?

View 1 Replies

State Management :: Session Mode State Server - Sending Asynchronous Request

Nov 5, 2010

Customer were getting "View State Validation Error" due to worker process recycling at our production webserver and to fix that i applied machinekey and then move my Session state Mode from In Proc to State Server to retain session data and not kick out the customer to relogin. I had serialization issue with one object which has to be stored in session but when i moved it out of session i could able to resolve the issue.

But doing all these i was partly successfull in keeping the user in their session when Worker Process recycle event occurs.I was able to refresh the page or make a post back by clicking the refresh button and also able to retain the session values. But the Problem occurs when sending asynchronous request to server which we do periodically every 15 minutes from the moment the user logs in.The web page doesnot update data on website when sending asynchronous request.By Debugging I found at this particular code point it fails to make a postback which is required.

<%=GetHintFromServer%> (When there is no Worker Process recycle i t gets replaced by
WebForm_DoCallback('__Page',message,ShowHint,null,null,false) on postback) Everything works fine when there is no Worker Process Recyling but when it happens looks like sending request asynchronously using javascript fails .Remember When I make a post back by manually clicking submit button everything works fine.

function SendRequest(msg, isBusy, chartMsg, vesselMsg)
_busy = isBusy;
if(chartMsg != null)
_element.SetMessage(true, chartMsg);
if(vesselMsg != null)
_element.ShowVesselLoading(true, vesselMsg);
_stuckWatchdog = setTimeout( "ClearPendingRequest();", 60000);
var message = msg;
var context = '';
alert( "Exception error on SendRequest(): " + e);

View 2 Replies

State Management :: Unable To Serialize The Session State In 'StateServer' And 'SQLServer' Mode

Dec 12, 2010

I am new to .net 4.0 and am using EF Model and SessionState Mode=SqlServer and I am getting this error below:

Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.

I checked the stack trace and its complaining about

[assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("PoplarGroveModel", "tblMenuRole", "tblMenu", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(PoplarGroveDataModel.Menu), "tblRole",


I marked it as serializable but then it complains about System.Data.Objects.ObjectContext is not marked as serializable and hence throws the same error.

View 1 Replies

State Management :: Recreate State Session Database In SQL Server 2008?

Apr 5, 2010

Our ASP.NET App uses ASP State Session Management and has been rebuilt about 2 years ago [With .NET Framework 2.0]. We are currently in .NET framework 3.5 and have moved to SQL Server 2008 - but continue to use the same ASPState database. The State database has been upgraded to SQL Server 2008. Since then we have are seeing timouts/locks on ASPStateTempSessions table. I am wondering if we have to rebuild this database from scratch with some newer scripts?

View 2 Replies

State Management :: Asp Create New Session State Cookie Each Time On Debugging?

Jan 21, 2011

I'm using the following line of code to display the number of users currently logged on:

lblNoOfUsers.Text = Membership.GetNumberOfUsersOnline().ToString()

I'm still debugging my application so it's on the local server. As I debug and stop then debug again, eventually lblNoOfUsers.text turns to "0" instead of "1", even as I'm navigating my application. It only turns to "1" again if I log out and sign back in. It's almost as though Membership.GetNumberOfUsersOnline my login are referencing two different session states. How is this possible? Does create a new session state cookie each time I start debugging?

View 2 Replies

State Management :: Losing Session State In Global.asax File?

Feb 2, 2011

I am trying to set a session variable in the global.asax file and keep running into the problem that the Session is null.

I am running my application in VS2008 and using 3.51.

Here is my code:

1. In my web.config file I have enabled the session state and added the following line;


2. In the Session_Start procedure in the Global.asax file I set the session variable to a default value.


My problem seems to be that when the Application_Error procedure is executed the session state is lost.

Does anyone know why the session state isn't available in the Global.asax file.

View 9 Replies

State Management :: Session State Expiration After Application Pool Recycle?

Nov 1, 2010

All we have a global ships position tracking website which runs smoothly until IIS application pool recycles.When there is workerprocess recycling looks like session state expires as a result i loose all session data and when customer clicks refresh button he is redirected to login page.

In web.config Session state mode is set to InProc so i changed it to State Server but to my luck i have MAP object which is not serialiazable which is causing the maps from not appearing on the website.I tried adding serializable attribute to the object class but still not succesfull.Our website is accessed by our customers whose count is more than 1000.

Changing the session state mode from InProc to StateServer can really slow down the response time so
Is it good to go further fix the serailizable issues and move to state server?.

Is there any way I can retain my session data when application pool recyles?..

Stopping Application pool from recycling may not be a good idea considering health factor of web server.

View 8 Replies

State Management :: Session State Returning Null Values?

Apr 29, 2010

I have a clear button and a textbox in an aspx page. I set the session variable in this page as

String str = Textbox1.Text;

Session["TypeIds"] = str;

and I clear the sessions in a clear button event as


Then when the user types some value in the textbox ,on Response.Redirect on another aspx page, the session variable returns null values.It does not retain its session state. The session state has to be maintained in the next page. Is it because this clear button event and setting explicitly to null creates this problem?

View 7 Replies

State Management :: Version 2.0 Session State Not Installed On SQL Server?

Oct 27, 2010

The fix for this error message is to run [Code]..... I have run that uptown, downtown and in my lady's chamber and it does no good, although it never complains. Are there any other possibilities?Details:
IIS Server: v5.1 running on XP. SQLServer 2005 running on a different XP box.Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618 There is an ASPState database on the server, containing only two tables: [Code].... and [Code]..... I did not use [Code].... when I ran [Code]....

View 2 Replies

State Management :: Session Variable Authentication State Timeout?

Dec 3, 2010

I am building a web app that is limited to one database, therefore I cannot use the ASP.NET config tool. As a quick means of getting this app online, I tried to use a simple session variable. The login page verifies the user's credentials, and if they pass, it sets the session variable to a certain value. All other pages check in the page_load event whether or not the session variable is equal to that value. The problem is that once being logged in for a short while and sending and recieving some data, the session variable resets, and I'm returned to the login page to repeat the process. Here's the basic code from my webforms:


Is there some setting I need to change in the web.config file to adjust the cookie timeout or is that only for the config tool authentication methods?

View 5 Replies

State Management :: When To Choose Out Proc Session State Mode

Feb 13, 2011

Just wanted to know in which type of web applications we can use or its good to use the out proc (SQL Server, State Server) session mode?

View 4 Replies

Copyrights 2005-15, All rights reserved