Hi guys, I'm having trouble passing my model to the controller> I wonder if this is a good practice or is it possible that this is possible.
Therefore. What do I want to achieve here
& lt;% foreach (DownloadFile file in model) {%> & Lt; A href = "& lt;% = Url.Action (" DownloadFile ", new {file = file})%>" & Gt; Click here to download & lt; / A & gt;
I want to pass the file file "file" to my controller which is like this:
Public Task Device DownloadLabTestResult (downloadfile file) {downloadfile file = file; ... Return the new filestream report (Response OutputStream, Response Contact Type); }
I tried to pass through a string or integer and its realm but when I want to pass the above mentioned object, I get a zero value. What is the proper way to do this? Thanks
When using FileStreamResult
, you must give it a stream that Represents the contents of the file, which will be sent to the customer and the customer. You have currently given the ASP.NET response stream instead. It can not possibly be read from it (this is only an output stream).
Therefore; Where's the content? Open a stream in that and pass it. Depending on your implementation, this local file system, a network file-system, a database, remote HTTP (etc) server, or some generated in-memory (usually memorystream
).
Equally, it tells MVC to you what the content type is; You Response *
should not use the value, because it is you are making .
Comments
Post a Comment