I followed this post:DataTable using Server Side Processing.
Inside default.aspx, I am calling .ashx using:
<script type="text/javascript">
$(function () {
$('#example').dataTable({
'bProcessing': true,
'bServerSide': true,
'sAjaxSource': '/data.ashx'
});
});
On Page_Load event of defaut.aspx:
Employee emp=new Employee();
emp.name="abc";
emp.addr="pqr";
emp.phone="123";
Where Employee is the name of Class.
How can I pass the Employee Object to Data.ashx?
I tried using HttpContext.Current.Session but is shows Session object as null.
Please Help.
To Access the session Inside I used
IRequiresSessionStateinterface as below:Ofcourse to set an Employee object in session, on
Page_Loadevent ofdefaut.aspx:NOTE:
There are two interfaces present to make access available to
HttpSessionin Generic Handler:IRequiresSessionState
Using this interface we can read and write the session variables.
IReadOnlySessionState
Using this interface we can only read and cannot write or edit the session variables.
For more information check this link: IRequiresSessionState vs IReadOnlySessionState