I have no idea how to do that, but I think it is possible. What I want to do is show progress of some process (loop) to my view.
I’m using C# ASP.NET MVC3/RAZOR
Code example:
public ActionResult Index()
{
for (int i = 0; i < 100; i++)
{
System.Threading.Thread.Sleep(100); // Simulate...
}
return View();
}
And in my view I just want to make simple text like 44/100.
Is it possible, and if it is then what would be the best way of achieving this?
BNL’s comment above is correct.
How do you keep track of progress?
And yes, it’s worth repeating: don’t run long tasks in the web server thread. Run a windows service and let it run the tasks for you.