Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Static in Asp.net

Static in Asp.net

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettestingbeta-testingquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Smith
    wrote on last edited by
    #1

    When you declare an object "static", will it be shared among different users of different machines? I couldn't test it cuz I'm testing from a single machine. I put a static variable in a common code and every time I visit a page, it shows the (user-specific) static data no matter how many refresh you make. that's fine. But will the same data be shown to any other users accessing the same page? "Static" has that much of scope??. Thanks for your reply.

    :beer:

    C N 2 Replies Last reply
    0
    • S Smith

      When you declare an object "static", will it be shared among different users of different machines? I couldn't test it cuz I'm testing from a single machine. I put a static variable in a common code and every time I visit a page, it shows the (user-specific) static data no matter how many refresh you make. that's fine. But will the same data be shown to any other users accessing the same page? "Static" has that much of scope??. Thanks for your reply.

      :beer:

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Yes, that is what static means. You have one server, one application instance, and static variables will be shared across it.

      Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

      1 Reply Last reply
      0
      • S Smith

        When you declare an object "static", will it be shared among different users of different machines? I couldn't test it cuz I'm testing from a single machine. I put a static variable in a common code and every time I visit a page, it shows the (user-specific) static data no matter how many refresh you make. that's fine. But will the same data be shown to any other users accessing the same page? "Static" has that much of scope??. Thanks for your reply.

        :beer:

        N Offline
        N Offline
        nyeboy
        wrote on last edited by
        #3

        It starts its life from page_load and ends its life until page_unload.

        studing is processing in this life.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups