In my ApiController class, I have following method to download a file created by server.
public HttpResponseMessage Get(int id)
{
try
{
strin
If you want to ensure that the file name is properly encoded but also avoid the WebApi HttpResponseMessage you can use the following:
Response.AddHeader("Content-Disposition", new System.Net.Mime.ContentDisposition("attachment") { FileName = "foo.txt" }.ToString());
You may use either ContentDisposition or ContentDispositionHeaderValue. Calling ToString on an instance of either will do the encoding of file names for you.