Domanda

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

È stato utile?

Soluzione

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");
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top