asp.net core MVC Write Report to File? Not Download
-
Hi,
i will create a report in .net core mvc with jsreport.
The pdf should write in a file, not as download. How can i do this?
In "OnAfterRender" function, i read the r.Content Stream. But my code excepted with a Message. ("Can't read a closed stream")Thank you for helping.
Best regards
Niklas
-
Does the error "Can't read a closed stream" come from your reading? Isn't it thrown afterwards?
I guess that it is thrown afterwards and it is because you read and close the stream, but the middleware tries to read it after theOnAfterRender
is finished.
You can try to set to ther.Content
the stream you actually want to return back to the response.