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. Weird Session variable.

Weird Session variable.

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

    Hi all I encounter a problem but don't know how to solve it. Here is my situtation: I have a web page, 2 user controls: A and B. A and B are dynamically loaded into the main page. In B there are 4 buttons, TextBox, object and classes,...There is one object I want to save all of its values and I decided to use Session["utility"] = myobject. For the first 3 button, I always remember to assign that object back to the Session for the next use, and it works fine for the first 3 buttons. The last button is a "Save All" button and I also want to retrive that object by: myojbect = (myclasstypehere)Session["utility"]. It breaks my code. Running debug I receive this: myobjec is null and there is a message like this:" Session["utility"] function 'Session.get_Item' evaluated and returned null ". I don't know why it gave me that error. I works with 3 other buttons but not with this. Thanks for any help

    A 1 Reply Last reply
    0
    • C caheo

      Hi all I encounter a problem but don't know how to solve it. Here is my situtation: I have a web page, 2 user controls: A and B. A and B are dynamically loaded into the main page. In B there are 4 buttons, TextBox, object and classes,...There is one object I want to save all of its values and I decided to use Session["utility"] = myobject. For the first 3 button, I always remember to assign that object back to the Session for the next use, and it works fine for the first 3 buttons. The last button is a "Save All" button and I also want to retrive that object by: myojbect = (myclasstypehere)Session["utility"]. It breaks my code. Running debug I receive this: myobjec is null and there is a message like this:" Session["utility"] function 'Session.get_Item' evaluated and returned null ". I don't know why it gave me that error. I works with 3 other buttons but not with this. Thanks for any help

      A Offline
      A Offline
      Anzy
      wrote on last edited by
      #2

      Hi, I'm not really sure why that's happening, but I remember experiencing similar problem before. I solved the problem by using 'ViewState["utility"]' instead of 'Session["utility"]' and everything's fine again. Hope this helps. Anzy

      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