PDA

View Full Version : Scope VB.NET


Sean
03-22-2003, 02:51 AM
I have dimensioned an array list as such

Public ItemsToOrder As New ArrayList()</font id="red">
prior to my Page load event in the Webform1 class

I wish for this array list to be retentive for the browser session
however on the following event
Private Sub Button1_Click </font id="red">
the page appears to reload and ItemsToOrder gets cleared.

I then moved Public ItemsToOrder As New ArrayList()</font id="red">
to module level but found that subsequent browser sessions of the same page did not correctly create a new instance of ItemsToOrder</font id="red">. The new session actually showed list items from another users session. I tried building a class . No luck either. I never had these issues with windows forms apps.. Help!!

New to Web Apps

bruce
03-22-2003, 10:57 AM
HTTP is a stateless protocol. That means the application do NOT remember any variables when you reload. This is one of the more common problem for VB application developer when developing web application.

YOu can use viewstate or session to maintain states.

These are some articles i found on the net that talks about state management

http://www.devx.com/dotnet/Article/10412

http://www.aspalliance.com/aspxtreme/webapps/aspstatemanagement.aspx

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspstatemanagement.asp

Hope this helps.

[b]quote:Originally posted by Sean

I have dimensioned an array list as such

Public ItemsToOrder As New ArrayList()</font id="red">
prior to my Page load event in the Webform1 class

I wish for this array list to be retentive for the browser session
however on the following event
Private Sub Button1_Click </font id="red">
the page appears to reload and ItemsToOrder gets cleared.

I then moved Public ItemsToOrder As New ArrayList()</font id="red">
to module level but found that subsequent browser sessions of the same page did not correctly create a new instance of ItemsToOrder</font id="red">. The new session actually showed list items from another users session. I tried building a class . No luck either. I never had these issues with windows forms apps.. Help!!

New to Web Apps

</blockquote id="quote"></font id="quote">

Sean
03-24-2003, 04:29 AM
Thanks a BUNCH! I've seen the light.

Alan
07-31-2003, 12:10 AM
OK, I've read about the different models and it appears that I can elect nearly any of these to solve my issues. But there are three bits of information I require from our patient Host that will ultimately affect the best course of action.

I have a large count of variables I wish to persist; some are long strings and others are integers.

1. Are we hosted on a single box, web-farm, or web-garden?
2. Which of these provides the least impact on our patient Host:</font id="green">
<ul> InProc
StateServer
SQLServer
Codebehind Class[/list]
3. Which of the above provide the fastest access?</font id="green">

Thanks in advance [:)]

bruce
07-31-2003, 03:30 AM
You are hosted on a single box

We only support inproc state

quote:Originally posted by Alan

OK, I've read about the different models and it appears that I can elect nearly any of these to solve my issues. But there are three bits of information I require from our patient Host that will ultimately affect the best course of action.

I have a large count of variables I wish to persist; some are long strings and others are integers.

[b]1. Are we hosted on a single box, web-farm, or web-garden?
2. Which of these provides the least impact on our patient Host:</font id="green">
<ul> InProc
StateServer
SQLServer
Codebehind Class[/list]
3. Which of the above provide the fastest access?</font id="green">

Thanks in advance [:)]
</blockquote id="quote"></font id="quote">