When to close memory streams if they are returned in methods and controllers
I have some code that will be generating an excel report and I am planning on using it for some scheduled tasks but always wanted to return it from my API endpoint as well. My code for my controller is as follows:
How to download a file to a memorystream from an API with authentication
I have a url that requires authentication to access the link. I am trying to download the data to a stream as follows: