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. Advertising

  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. Advertising

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. Paul Opal
    Replies:
    12
    Views:
    926
    Paul Opal
    Oct 11, 2004
  2. ann
    Replies:
    13
    Views:
    646
    Patricia Shanahan
    Sep 13, 2005
  3. Steven T. Hatton
    Replies:
    9
    Views:
    457
  4. David Filmer
    Replies:
    19
    Views:
    221
    Kevin Collins
    May 21, 2004
  5. Andrew Falanga
    Replies:
    2
    Views:
    191
    Andrew Falanga
    Nov 22, 2008
Loading...

Share This Page