I have to webmethod in which I want to use session variable something like this
[WebMethod(enableSession: true)]
public List<int> FirstMethod()
{
List<int> ListValue=getListValue();
Session["ListValue"]=ListValue;
return ListValue;
//It works fine and it also return List of integers which is ok
}
Now I want to use this session value of "ListValue" in another method which is not working it returns me null value instead of List which was expected something like this
[WebMethod(enableSession: true)]
public List<int> SecondMethod()
{
if(Session["ListValue"]!=null)//null value in session :(
{List<int> ListValue=(List<int>)Session["ListValue"];
return ListValue;
}
else
return null;
}
}