Interviews - C# Corner

Anshu Kumar
What is session? How do you initialize a session and how you declare it?
By Anshu Kumar in .NET onApr 06 2019
  • Vaibhav Surve
    Jul, 2019 18

    Session Declaration is all follow
    {
    Session[“UserName”]=”Vaibhav”;
    }

    Use declared session like
    {
    string Name =(string)Session[“UserName”];
    }

    • 1
  • Bidyasagar Mishra
    Jul, 2019 23

    Declare :
    Session[“userId”]=”1”;
    Retrive:
    string userId =(string)Session[“userId”];

    • 0
  • Santosh Kumar Rangumudri
    Jul, 2019 1

    Session is a cookie variable in server and it is handle in server level in our entire web technologies (asp.net,asp.net mvc).

    1. in asp.net
      1. System.web.HttpContext httpcontext= new System.web.HttpContext();
      2. httpcontext.Current.Requiest.Session["variable_name"]="variable_value";
    2. in Asp.net MVC
      1. Session["variable_name"]="Session value";
      I hope above is ok our understanding purpose.

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS