Variable Scope and IIS

Discussion in 'ASP .Net' started by TSW, Apr 26, 2004.

  1. TSW

    TSW Guest

    I am a fairly new programmer who is seeking some insight
    into variable scope and IIS.

    I have recently completed development on an ASP.Net
    application (VB.Net). In order to make certain variables
    available to all my subroutines I defined them as
    follows: Shared VariableName

    While this met my immediate need, it appears to be
    causing problems when several users are accessing my
    application concurrently. User A is getting variable
    information from User B, etc.

    I was under the impression that IIS created a unique
    instance of my application for each user and that all
    variable information would be available only to that
    specific user. It appears that my assumption was
    incorrect.

    My question is as follows: How can I dimension variables
    that are available to all of the sub routines contained
    in my class file, but at the same time limit the scope to
    the user that initiated the application?

    Any assistance would be greatly appreciated.

    Regards,
    TSW
     
    TSW, Apr 26, 2004
    #1
    1. Advertisements

  2. There is only ONE application. All code runs in that context.

    > My question is as follows: How can I dimension variables
    > that are available to all of the sub routines contained
    > in my class file, but at the same time limit the scope to
    > the user that initiated the application?


    Session will store them in a Collection that is available to all pages of a
    single User. ViewState will store data in a serializable Collection that
    exists for the life of a single Page of a single User.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.

    "TSW" <> wrote in message
    news:45e701c42b9c$e62985f0$...
    > I am a fairly new programmer who is seeking some insight
    > into variable scope and IIS.
    >
    > I have recently completed development on an ASP.Net
    > application (VB.Net). In order to make certain variables
    > available to all my subroutines I defined them as
    > follows: Shared VariableName
    >
    > While this met my immediate need, it appears to be
    > causing problems when several users are accessing my
    > application concurrently. User A is getting variable
    > information from User B, etc.
    >
    > I was under the impression that IIS created a unique
    > instance of my application for each user and that all
    > variable information would be available only to that
    > specific user. It appears that my assumption was
    > incorrect.
    >
    > My question is as follows: How can I dimension variables
    > that are available to all of the sub routines contained
    > in my class file, but at the same time limit the scope to
    > the user that initiated the application?
    >
    > Any assistance would be greatly appreciated.
    >
    > Regards,
    > TSW
     
    Kevin Spencer, Apr 26, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cole Trickle

    variable scope and persistence

    Cole Trickle, Jan 21, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    435
    David Jessee
    Jan 21, 2005
  2. Paul Opal
    Replies:
    12
    Views:
    1,219
    Paul Opal
    Oct 11, 2004
  3. ann
    Replies:
    13
    Views:
    881
    Patricia Shanahan
    Sep 13, 2005
  4. Steven T. Hatton
    Replies:
    9
    Views:
    714
  5. Xah Lee
    Replies:
    0
    Views:
    2,474
    Xah Lee
    Feb 26, 2009
  6. David Filmer
    Replies:
    19
    Views:
    531
    Kevin Collins
    May 21, 2004
  7. Replies:
    0
    Views:
    334
  8. Andrew Falanga
    Replies:
    2
    Views:
    395
    Andrew Falanga
    Nov 22, 2008
Loading...