Get the value using Session in C#.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Limno
    New Member
    • Apr 2008
    • 92

    Get the value using Session in C#.net

    Hi,

    Suggest me, how to get the value using Session in C#.net. if i enter the value in one webform, it must display in another webform while i open that 2nd webform. But i dont want to redirect automatically. if i open that 2nd webform, it should display.

    Need immediately,
    Anyone Please reply me.
    Limno
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Originally posted by Limno
    Hi,

    Suggest me, how to get the value using Session in C#.net. if i enter the value in one webform, it must display in another webform while i open that 2nd webform. But i dont want to redirect automatically. if i open that 2nd webform, it should display.

    Need immediately,
    Anyone Please reply me.
    Limno
    Add to session
    Code:
    Session["key"] = "value";
    Retrieve from Session
    Code:
    string key = Session["key"].ToString();
    Remember, "key" could be any name. Also, you can store any object, not just strings. And if you do store a different type, make sure to cast properly, because Session["anyvalue"] returns an Object.

    Comment

    Working...