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. Sanity Check

Sanity Check

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netquestion
2 Posts 2 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.
  • A Offline
    A Offline
    Adam Wimsatt
    wrote on last edited by
    #1

    ASP.NET 2.0 is also stateless in that static variables in the page behind will not maintain their value between page loads correct?


    // TODO: Write code.

    A 1 Reply Last reply
    0
    • A Adam Wimsatt

      ASP.NET 2.0 is also stateless in that static variables in the page behind will not maintain their value between page loads correct?


      // TODO: Write code.

      A Offline
      A Offline
      Andy Brummer
      wrote on last edited by
      #2

      Sorry, didn't see the 2.0 in the question. This applies to 1.0 and 1.1, but I would think that it would be a huge breaking change to change this behavior in 2.0. Static variables are maintained until the AppDomain is recycled. If you use static variables in ASP.Net they need to be protected with locks. In most cases, an application level variable is a better choice for static type data. Also, if you need something at a request level of granualarity, the context has an items collection.

      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