The Session property
provides programmatic access to the properties and methods of the
Because ASP.NET pages contain a default reference
to the System.Web
namespace (which contains the
you can reference the members of HttpContext on an .aspx page without using
the fully qualified class reference to HttpContext.
For example, you can use Session["SessionVariable1"]
to get or set the value of the session state variable
so, you just use session as below,...
// to set session variable write statement as below,
Session["UserId"] = 1;
" is name of your session variable which is set to value 1
in above line. no declaration
like integer,string etc...
To fetch value of session variable...
int UserId = Session["UserId"] ;