Good Day All
I have a web Method defined like this
[System.Web.Services.WebMethod]
public static bool CheckSessionExpiration()
{
System.Web.HttpContext.Current.Session["CurrentLoginUser"] = null; //This is for Testing Purpose
if (UserSecurity.GetLoggedInUser() == null)
{
return false;
}
else
{
return true;
}
}
and in Jquery i have a function that calls this
function ProcessAction() {
PageMethods.CheckSessionExpiration(OnCheckSessionExpirationComplete, OnCallError);
if (IsLogin == true) {
alert("Inside the Function");
var txtNote = $("[id$=txtNote]").val();
var txtIdentNo = $("[id$=txtIdentNo]").val();
var sIdentNo = "";
DisableControls();
CleanIdentNoList();
if (ValidFields()) {
//Get Subscriber Detail
gAction = $("[id$=cmbAction]").val();
gNote = txtNote;
sIdentNo = jQuery.trim(txtIdentNo);
gMSISDNList = sIdentNo.split("\n");
gMSISDNIndex = -1;
ProcessNextItem();
}
else {
EnableControls();
}
}
else {
window.location = "Login.aspx";
}
}
and i have a Callback function defined like this
function OnCheckSessionExpirationComplete(result,methodName) {
if (result == false) {
IsLogin = false;
}
else {
IsLogin = true;
}
}
Now the "IsLogin" variable is a Global variable defined like this
var IsLogin = true;
What i want to do is to redirect the user if the Session is null, as you can see i have added the line
System.Web.HttpContext.Current.Session["CurrentLoginUser"] = null; //This is for Testing Purpose
For testing Purpose , but my problem is is that, even if its null, the
alert("Inside the Function");
is fired, what i am i doing wrong.
THanks