A controller action which returns a partial view inserts the logon page when authorization fails

前端 未结 2 1510
深忆病人
深忆病人 2020-12-23 12:12

I have a view that loads a partial view from a controller action using jQuery. The controller action is decorated with the Authorize attribute and if the user has timed out

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-23 13:11

    For Simen Echholt second solution you can use

    $.ajaxSetup({ global: true,
        statusCode: {
            401: function () {
                alert("unauthorized");
            }
        }
    });
    

    to bind some your function on status code 401

提交回复
热议问题