Change :
[WebMethod]
public void CheckSession()
{
if (Session[KaizenConstants.CURRENTLOGGEDINUSER] == null)
{
Response.Redirect("Login.aspx");
}
}
to
[WebMethod]
public static AjaxResponse<bool> CheckSession()
{
AjaxResponse<bool> oResponse = new AjaxResponse<bool>();
oResponse.Data = Session[KaizenConstants.CURRENTLOGGEDINUSER] == null;
return oResponse
}
Link : Why do asp.net ajax page methods have to be static?
This is a general container class
public class AjaxResponse<T>
{
public AjaxResponse()
{
Status = ResponseStatus.OK.ToString();
ErrorMsg = "";
}
public string Status { get; set; }
public string ErrorMsg { get; set; }
public T Data { get; set; }
}
success: function (result) {
if (result.d != '')
result = result.d
if (result.Data == 'True') {
}
}