admin管理员组

文章数量:1291124

I have a jquery Ajax call implemented for keepalive the session, this keepAlive() method will call in every 20 mins

    function keepAlive() {
        $.ajax({ type: "POST",
            url: "KeepAliveDummy.aspx", cache: false
        });
    }

This call is happen when the third party contents are loaded in to the frameset,

I'm getting 403 http status (check via fiddler) on this request, Will this impact the end result of refresh the session time out?

I have a jquery Ajax call implemented for keepalive the session, this keepAlive() method will call in every 20 mins

    function keepAlive() {
        $.ajax({ type: "POST",
            url: "KeepAliveDummy.aspx", cache: false
        });
    }

This call is happen when the third party contents are loaded in to the frameset,

I'm getting 403 http status (check via fiddler) on this request, Will this impact the end result of refresh the session time out?

Share Improve this question asked Feb 24, 2014 at 5:12 KRRKRR 5053 gold badges6 silver badges23 bronze badges 3
  • 2 http status 403 is forbidden,check whether its CORS issue – Cris Commented Feb 24, 2014 at 5:15
  • en.wikipedia/wiki/HTTP_403 – Deepak Ingole Commented Feb 24, 2014 at 5:15
  • use dataType and contentType in your ajax call.. may be it will helped you. – angfreak Commented Feb 24, 2014 at 5:18
Add a ment  | 

2 Answers 2

Reset to default 6

Since your question is about handling 403 error (Will this impact the end result of refresh the session time out?) rather what 403 is.

So, handle this error, you can log or notify.

  $.ajax({
      type: "POST",
      url: "KeepAliveDummy.aspx",
      success: function (response) {
          //session refreshed
      },
      error: function (xhr, ajaxOptions, thrownError) {
        if(xhr.status==403) {
            //handle error
        }
      }
    });

about 403 :

403 Forbidden The request was a valid request, but the server is refusing to respond to it.[2] Unlike a 401 Unauthorized response, authenticating will make no difference.[2]

it needs you to authenticate (like login) first before do call ajax. 401 error requires authenticating header field when request but 403 doesn't.

check your server or contact who has responsibility for authentication.

本文标签: javascriptJquery Ajax call return 403 statusStack Overflow