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. Persisting Custom Business Objects

Persisting Custom Business Objects

Scheduled Pinned Locked Moved ASP.NET
winformsbusinesshelpquestion
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.
  • L Offline
    L Offline
    LeeOvEngland
    wrote on last edited by
    #1

    I have a number of custom business objects that have private variables, properties and methods coded into class files and compiled into a dll. When I create an instance of one of these objects on a page(.aspx) I can use the properties to modify the attributes of the object. If I then make a postback to the page by clicking a button the object re-initializes itself during Page_Load() and the data is lost. When I use objects in windows forms applications once they are created they persist no matter what events occur within the windows form until you destroy the object. I want to be able to keep the object live so I can use it on this page or any other page I may navigate to. I have used Session to store the objects and this seems to work but it involves checking for an instance of the object in Session on Page_Load() event and I understand that it is not the correct way to do this. All in all, how can I keep an object live on the webserver that can be initialized / created on any page within the web application without using Session. I would appreciate any help with this matter Thank You

    R 1 Reply Last reply
    0
    • L LeeOvEngland

      I have a number of custom business objects that have private variables, properties and methods coded into class files and compiled into a dll. When I create an instance of one of these objects on a page(.aspx) I can use the properties to modify the attributes of the object. If I then make a postback to the page by clicking a button the object re-initializes itself during Page_Load() and the data is lost. When I use objects in windows forms applications once they are created they persist no matter what events occur within the windows form until you destroy the object. I want to be able to keep the object live so I can use it on this page or any other page I may navigate to. I have used Session to store the objects and this seems to work but it involves checking for an instance of the object in Session on Page_Load() event and I understand that it is not the correct way to do this. All in all, how can I keep an object live on the webserver that can be initialized / created on any page within the web application without using Session. I would appreciate any help with this matter Thank You

      R Offline
      R Offline
      Ryan Roberts
      wrote on last edited by
      #2

      LeeOvEngland wrote: I want to be able to keep the object live so I can use it on this page or any other page I may navigate to. I have used Session to store the objects and this seems to work but it involves checking for an instance of the object in Session on Page_Load() event and I understand that it is not the correct way to do this. Why not? unless they are bloody enormous this is a perfectly resonable thing to do. Create a wrapper class for your session state to encapsulate the Session["easytomistypename"] stuff and code away. Ryan

      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