Pagemethods in JQuery
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Pagemethods in JQuery

  1. #1
    Join Date
    Dec 2007
    Location
    South Africa
    Posts
    263

    Pagemethods in JQuery

    Good Day All

    I have a web Method defined like this
    Code:
    		[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() {


    Code:
     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

    Code:
    function OnCheckSessionExpirationComplete(result,methodName) {
        if (result == false) {
            
            IsLogin = false;
        }
        else {
    
            IsLogin = true;
        }
    
    }
    Now the "IsLogin" variable is a Global variable defined like this


    Code:
    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
    Code:
    	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


    Code:
    alert("Inside the Function");
    is fired, what i am i doing wrong.

    THanks
    Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,865

    Re: Pagemethods in JQuery

    [ moved thread ]
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Dec 2007
    Location
    South Africa
    Posts
    263

    Re: Pagemethods in JQuery

    To where?
    Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

  4. #4
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,865

    Re: Pagemethods in JQuery

    Read the breadcrumb links at the top or bottom of this thread...and you would know.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center