1:
public void DownloadFile(string ID)
{
var context = HttpContext;
string name;
string ext;
var filePath = _qrCodeControlService.GetFilePath(ID, out name,out ext);
if (System.IO.File.Exists(filePath))
{
context.Response.AddHeader("Content-Disposition", "attachment; filename=\"" + name + "." + ext + "\"");
context.Response.ContentType = "application/octet-stream";
context.Response.ClearContent();
context.Response.WriteFile(filePath);
//return this.File(filePath, "application/octet-stream", Url.Encode(model.At_DisplayName) + "." + model.At_Extension);
}
else
context.Response.StatusCode = 404;
}
2.
[HttpGet]
public ActionResult ExpProjtectThird(string filePath)
{
var name = Path.GetFileName(filePath);
return File(filePath, "application/vnd.ms-project", name);
}