Scope VB.NET

Discussion in 'Visual Studio' started by Sean, Mar 22, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. 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
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    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/d...n-us/cpguide/html/cpconaspstatemanagement.asp

    Hope this helps.

    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">
     
  3. Thanks a BUNCH! I've seen the light.
     
  4. 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 [:)]
     
  5. Bruce

    Bruce DiscountASP.NET Staff

    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.

    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">
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page