First you should get knowledge of Session.
Before retrieving HttpContext.Current.Session follow following steps.
-
Set Session Value:
HttpContext.Current.Session["ID"] = value;
-
Get Session Value:
var value = HttpContext.Current.Session["ID"];
Be confirm you have derived System.Web.dll reference in your project Reference
You will get error = "Object reference not set...."
when key in Session["ID"]
not matched and this is case sensitive.