Hi all,
Does anyone knows or have links to samples or tutorials about how to send files to client from the ApplicationServices?
Do I just sent the encoded byte array in an OutputDTO?
Thanks.
3 Answer(s)
-
0
Use regular Web API Controller or MVC Controller for it. Do not use app service since web streaming is a web stuff and should be in web layer.
-
0
After some reading up on SO, I now understand that sending the file as a response of an ajax request is not possible. So I now want to try something like this:
-
When the user wants to export some data to PDF, I use ApplicationService to Enqueue the document generation job in Hangfire. I am using SQL Storage for jobs.
-
Inside the Background Job it will retrieve all the data (job control and related data from DB) then go off and generate the document. Finally it saves the file in a folder on the server.
-
There should be something to keep polling the Job status(but I am not sure what?), when the job status changed to READY, it then sends a SignalR message to client (download URL inside the message payload)
-
When the client received the message, it will trigger a File Download action to download the file from server.
What I have tried now:
-
I have the ApplicationService successfully enqueued job in both local and remote Hangfire server, I have verified this with the use of Hangfire dashboard
-
I have also have the Background job to successfully generate, store the file to a specific folder and updated the job status to READY in DB. I have verified this by running sql queries to check the data records.
-
I am stuck on this point, I am not sure will the polling of job status be done in the Hub or using another recurring job or should the Hangfire Job asks the Hub to send a message to the specific user at the end of the Background job execution?
-
I have done a MVC controller with FileStreamActionResult ready for accepting the download requests from the clients.
So what am I missing?
Thanks.
-
-
0
Hi...
Is there a method similar to Response.Redirect that will send variables to the destination page other than using a query string or the post method???