Search code examples
c#asp.net-mvcc#-4.0asp.net-mvc-4monotorrent

Return data when page is still loading


I have a TorrentLeech application with ASP.Net MVC 4 and MonoTorrent library. I want to show the progress of downloading. I don't know how can I do that but I just know that page shouldn't stop loading because the action stops working. Can anybody help me?

this is my action but it's still basic:

public ActionResult Tr()
{
    MonoTorrent.Common.Torrent t = null;
    t = MonoTorrent.Common.Torrent.Load(@"E:\Downloads\[isoHunt] Men in Black 3 [ENG] 2012 DVDRip XviD-LPD.torrent");
    MonoTorrent.Client.TorrentManager tm = new MonoTorrent.Client.TorrentManager(t, @"E:\Downloads\[isoHunt] Men in Black 3 [ENG] 2012 DVDRip XviD-LPD\", new MonoTorrent.Client.TorrentSettings(0, 60, 0, 0));

    return View();
}

Solution

  • You could have a controller action which immediately returns a view in which you would show some spinner animation and kick an AJAX request to another controller action that will perform the actual task.