Pagemethods in JQuery [Resolved]

Posted by Vuyiswamb under jQuery on 1/25/2011 | Points: 10 | Views : 1604 | Status : [Member] [MVP] [Administrator] | Replies : 1
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

Thank you for posting at Dotnetfunda
[Administrator]



Responses

Posted by: Vuyiswamb on: 1/31/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down

Resolved
This is just strange , but i got the Solution.

Thank you for posting at Dotnetfunda
[Administrator]

Vuyiswamb, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response