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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -