No errors and not save enithing to database when authentication timeout

2 posts, 0 answers
  1. pbondarchuk
    pbondarchuk avatar
    1 posts
    Member since:
    Aug 2007

    Posted 20 Nov 2014 Link to this post

    I am using latest trial Kendo.Mvc.dll
    I have grid with popup editing.

            .Editable(editable => editable.Mode(Kendo.Mvc.UI.GridEditMode.PopUp).TemplateName("Template").Window( w => w.Width(960)))       
            .Pageable(pageable => pageable
            .DataSource(dataSource => dataSource
                .Model(model => model.Id(p => p.NSTemplateID))              
                .Read(read => read.Action("Templates_Read", "TemplateManager").Data("additionalData"))                  
                .Update(update => update.Action("Templates_Update", "TemplateManager"))
                .Events(events => events.Error("error_handler").RequestStart("request_start"))                                 

    All working good but when authentication timeout - no errors.
    How I can handle timeout and show warning to user?

  2. Daniel
    Daniel avatar
    2231 posts

    Posted 24 Nov 2014 Link to this post


    By default MVC will directly redirect to the login  page and will not return an error response so no errors will be shown. You could use a custom AuthorizeAttribute for the grid actions that returns a custom error as JSON and show the message in the dataSource error event e.g.
    public class DataSourceAuthorizeAttribute : AuthorizeAttribute
        protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
            filterContext.Result = new JsonResult()
                Data = new DataSourceResult { Errors = new { authentication = new { errors = new[] { "message" } } } }
    public ActionResult Update(...)


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top