Skip to content

Instantly share code, notes, and snippets.

@hvitorino
Created October 11, 2013 15:10
Show Gist options
  • Save hvitorino/6936353 to your computer and use it in GitHub Desktop.
Save hvitorino/6936353 to your computer and use it in GitHub Desktop.
Obrigado IE8 por dificultar minha vida sempre que possível ! \o/
public class ArquivoAnexoResult : FileContentResult
{
public ArquivoAnexoResult(byte[] data)
: base(data, "application/octet-stream")
{
}
public ArquivoAnexoResult(byte[] data, string fileName)
: this(data)
{
if (fileName == null)
{
throw new ArgumentNullException("fileName");
}
this.FileDownloadName = fileName;
}
public override void ExecuteResult(ControllerContext context)
{
context.HttpContext.Response.ClearHeaders();
base.ExecuteResult(context);
context.HttpContext.Response.Cache.SetCacheability(HttpCacheability.Private);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment