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.)

Était-ce utile?

La 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");
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top