In my MVC application when user clicks a particular link(a href) , an image will be downloaded.
Below is the action code which downloads the image
public ActionResult Download()
    {
        try
        {
            HttpClient client = new HttpClient();
            byte[] data = client.GetByteArrayAsync("http://public.slidesharecdn.com/b/images/logo/linkdsfsfsfsfedin-ss/SS_Logo_White_Large.png?6d1f7a78a6").Result;
            return File(data, "application/jpg", "testimage.jpg");
        }
        catch (Exception err)
        {
            return new HttpNotFoundResult();
        }
    }
But incase of exception it will display default IIS "HTTP Error 404.0 - Not Found" page, instead I would like to display javascript alert "Image not found".
To implement this requirement , do I need to make an AJAX call, instead of direct HTTP GET?
 
     
     
    