Last post May 11, 2016 08:28 AM by Chris Zhao
May 06, 2016 08:42 AM|LuciaLP|LINK
I am new to developing with ASP.NET and C# and I would want to ask the following question:
I am developing a web site to display reports with three pages .aspx: one to login, another to select the parameters which will be sent to the report and a third page which contains a ReportViewer object to show a Reporting Services remote server report.
The third page also contains a button to export the report in a .csv file and then this .csv file is sent to the user by email.
My problem is that the report is huge and the export process takes a very long time blocking the web page so the user cannot continue navigating. I have done a test with a background thread but it blocks the page (main thread) too. The background thread
is created in "onclick" method of the button.
Thread email = new Thread(delegate()
String nombreFichero = ExportarInforme(); //convert to .csv file
enviarCorreo(); //send email with the attachment
email.IsBackground = true;
ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Correo enviado');", true);
I have also used a BackgroundWorker object but it still blocks the page.
My idea is to click the button and open a new tab. The background thread (file export) should be run in this new tab unblocking the web page allowing the user to navigate through it. Is this possible? How could it be done?
Thanks in advance.
May 06, 2016 12:03 PM|raju dasa|LINK
Check this site, you can use any of the libraries or simple code:
May 06, 2016 05:58 PM|Khuram.Shahzad|LINK
May 11, 2016 08:28 AM|Chris Zhao|LINK
You could consider using some open source like Hangfire, it is completely free for commercial use.