I am trying to download a file uploaded from a location on server. Here is the code i am using
to download a file
Response.ContentType = "image/jpg";
Response.AddHeader("Content-Disposition", "attachment;filename=\"" + filePath + "\"");
Response.TransmitFile(Server.MapPath(filePath));
Response.End();
Here i have files of various extensions i.e a file can be a jpg/pdf/doc/txt i am currently setting ContentType to image/jpg.
When i try to download a file than it gets Saved properly and than can be opened from the physical location where it is saved but the Open does not work and the file is not downloaded i get the error as shown in the picture.


This issue is even when i try to Open a file of type jpg so i dont think it is something to do with ContentType
Kindly help.
I specified
Content-Typeasoctet-streamand it worked!