Search code examples
sessionsession-statefreeze

How to expire session using jquery/javascript in my mvc applicatoin


In my application i m processing xml file differences. Some time when processing xml file differences the response is being hanged due to which some time i refresh the browser so that the loader will remove and processing will start again.

I want to expire session when such type of hanging problem occur? OR what other I do for removing such type of bug? Please suggest.

Please note that, i m using MVC 3.0 using fluent nhibernate.


Solution

  • What I would do is start a timer in java-script. when you call your function to process the xml differences start the timer and when it fires after X amount of milliseconds call an ajax function to your mvc controller where you expire your session via .net or set it to null. from their you can either redirect to a different view or the same one starting the process over or you can return a var to the javascript triggering the function to just be called again without a page refresh if that will work