jquery - DataTables ASP.Net timeout issue -
we using datatables asp.net mvc , identity framework. have set authentication timeout 1 minute using code below:
public partial class startup { public void configureauth(iappbuilder app) { ... app.usecookieauthentication(new cookieauthenticationoptions { expiretimespan = system.timespan.fromminutes(1), provider = new cookieauthenticationprovider { ... });
i login , go page datatable , wait timeout. error occurs if timeout expires , datatable tries hit server. datatable works making ajax request server , error comes from.
the error javascript error:
datatables warning: table id=datatables_table_0 - invalid json response. more information error, please see http://datatables.net/tn/1
i need handle gracefully , redirect user login page.
can please?
you can use application_error
event handler in global.asax
file. add the:
protected void application_error(object sender, eventargs e) { //redirect code here }
method, , load in code check if login valid. if not, can route them page. in 1 of projects while used routedata
class send them page:
//send error page var routedata = new routedata(); routedata.values.add("controller", "error"); if (!userauthorized) routedata.values.add("action", "notauthorized"); else routedata.values.add("action", "index"); routedata.values.add("message", exception.message); icontroller errorcontroller = new devwebapp.controllers.errorcontroller(); errorcontroller.execute(new requestcontext(new httpcontextwrapper(context), routedata));
Comments
Post a Comment