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. How can i use Application Object

How can i use Application Object

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netquestion
6 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.
  • M Offline
    M Offline
    mghiassi
    wrote on last edited by
    #1

    Hi all, I use Application object in ASP.NET. I set it’s value in one page and read it in another page but I don’t know when I can dispose this object in order to in the first page it’s not set and if an event accord it set again. Thanks in advance

    K 1 Reply Last reply
    0
    • M mghiassi

      Hi all, I use Application object in ASP.NET. I set it’s value in one page and read it in another page but I don’t know when I can dispose this object in order to in the first page it’s not set and if an event accord it set again. Thanks in advance

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      You should only use the application object for things you want to keep across user sessions. Like some sort of static data that all users would be looking at. It sounds like you should be using a session variable to pass things from one page to the next. Session is very similar to the application object except it is only for that user, other users can see that object, they can only see their own session object. Either way if you want to remove and object from the session or application you can just set it to null or Nothing in vb.net. There is also a Remove method in the object to remove something from the application or session object. Hope that helps. Ben

      M 1 Reply Last reply
      0
      • K kubben

        You should only use the application object for things you want to keep across user sessions. Like some sort of static data that all users would be looking at. It sounds like you should be using a session variable to pass things from one page to the next. Session is very similar to the application object except it is only for that user, other users can see that object, they can only see their own session object. Either way if you want to remove and object from the session or application you can just set it to null or Nothing in vb.net. There is also a Remove method in the object to remove something from the application or session object. Hope that helps. Ben

        M Offline
        M Offline
        mghiassi
        wrote on last edited by
        #3

        When i can use it?(What event)

        K 1 Reply Last reply
        0
        • M mghiassi

          When i can use it?(What event)

          K Offline
          K Offline
          kubben
          wrote on last edited by
          #4

          You can use the session and application object anywhere in the codebehind. All events have access to it. Ben

          M 1 Reply Last reply
          0
          • K kubben

            You can use the session and application object anywhere in the codebehind. All events have access to it. Ben

            M Offline
            M Offline
            mghiassi
            wrote on last edited by
            #5

            I use it in Finalize Method of the page but in order to access again to it i don't know What i can?

            K 1 Reply Last reply
            0
            • M mghiassi

              I use it in Finalize Method of the page but in order to access again to it i don't know What i can?

              K Offline
              K Offline
              kubben
              wrote on last edited by
              #6

              Perhaps it is better for you to explain what you are trying to do and then I might be able to suggest something for you to try. Finalize method of the page seems like a strange place to set a variable in session or application. Most of the time I set it in th page load event. Ben

              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