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

  • 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 the OnAfterRender is finished.
    You can try to set to the r.Content the stream you actually want to return back to the response.

Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.