How to handle session timeout when using kendo combo-box?
Below is my html code for kendo combobox
@(Html.Kendo().ComboBoxFor(model => model.PropertyName)
.AutoBind(true)
.Suggest(true)
.DataTextField("Text")
.DataValueField("Value")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("ActionName", "ControllerName");
})
.ServerFiltering(true);
})
.Animation(false)
.Filter("contains")
.HighlightFirst(false)
)
When read.Action called at that time in controller session timeout occurred and I have written custom attribute to check for session expire and return 403 status code using below code
if (filterContext.RequestContext.HttpContext.Request.IsAjaxRequest())
{
filterContext.Result = new HttpStatusCodeResult(HttpStatusCode.Forbidden, "Forbidden");
return;
}
And this returned status handled in layout.cshtml page using below code and reload the page to go to login page
$.ajaxSetup({
error: function (x, e) {
if (x.status == 403) {
window.location.reload();
}
}
});
It works for all ajax request but not work when ajax request from kendo combobox. please, help me to handle it while kendo combobox ajax request.