1

I am working on a .NET MVC 4 web application. One of my ActionMethod takes long time (around 2 minutes) to finish the task and response back to client. I am calling this ActionMethod via JQuery AJAX call. Everything is working as expected but now I have to also display the current status of the ActionMethod. For example weather method is "in progress" or "completed" or "failed" etc on client html page.

To achieve this task I found AsyncController class and read this article Click here, but I think this is very old way.

I need the latest and best approach to call a long running .NET MVC Action Method with user feedback on client.

Kishan Gupta
  • 586
  • 1
  • 5
  • 18
  • 1
    Just update the DOM using jQuery. "In progress" is set right before you send the ajax request, "completed" in the success handler, and "failed" in the error handler. – nurdyguy Aug 22 '17 at 20:02
  • a jQuery ajax call is asynchronous by definition, so I don't think you need to change your Action, just as suggested in the comment above you can use the $ajax :success and :error methods. – Victor Hugo Terceros Aug 22 '17 at 22:26
  • 1
    I think the key here is ***ActionMethod takes long time*** You should take a look at: http://www.hanselman.com/blog/HowToRunBackgroundTasksInASPNET.aspx – Helder Sepulveda Aug 23 '17 at 14:09

0 Answers0