Question

I am using Sitefinity w/MVC. I want a controller for an MVC Component to return a file to the client. The file is built in memory. How do I deliver the file to the client from either a byte stream or string?

Thanks.

(I have tried searching for everything I can think of relating to this, but searches are only pulling up files about sitefinity that I can download, instead of help with code.)

Was it helpful?

Solution

You can return FileResult like in any other ASP.NET MVC controller action.

public ActionResult Download()
{
    return this.File("C:\\Work\\MyImage.png", "image/png");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top