Question: Rather than displaying a PNG in the browser window, I'd like the action result to trigger the file download dialogue box (you know the open, save as, etc). I can get this to work with the code below using an unknown content type, but the user then has to type in .png at the end of the file name. How can I accomplish this behavior without forcing the user to type in the file extension?

```
    public ActionResult DownloadAdTemplate(string pathCode)
    {
        var imgPath = Server.MapPath(service.GetTemplatePath(pathCode));
        return base.File(imgPath, "application/unknown");
    }

```

### Solution....

```
    public ActionResult DownloadAdTemplate(string pathCode)
    {
        var imgPath = Server.MapPath(service.GetTemplatePath(pathCode));
        Response.AddHeader("Content-Disposition", "attachment;filename=DealerAdTemplate.png");
        Response.WriteFile(imgPath);
        Response.End();
        return null;
    }

```

Answer: 
I believe you can control this with the content-disposition header.

```
Response.AddHeader(
       "Content-Disposition", "attachment; filename=\"filenamehere.png\""); 

```
With MVC I use a [FileResult](http://msdn.microsoft.com/en-us/library/system.web.mvc.fileresult%28v=vs.108%29.aspx) and return a [FilePathResult](http://msdn.microsoft.com/en-us/library/system.web.mvc.filepathresult%28v=vs.108%29.aspx)

```
public FileResult ImageDownload(int id)
    {
        var image = context.Images.Find(id);
        var imgPath = Server.MapPath(image.FilePath);
        return File(imgPath, "image/jpeg", image.FileName);
    }

```