Am trying to download the .7z file using our website application.But it shows the below error.
HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map can anyone suggest me how can I resolve this issue?
Thanks in advance. Regards, Nithya G
You need to set the MIME type on the server:
application/x-7z-compressed
How to set MIME Types on IIS: http://www.iis.net/configreference/system.webserver/staticcontent/mimemap
Here is an example using a button:
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
code behind:
protected void Button1_Click(object sender, EventArgs e)
{
Response.ContentType = "APPLICATION/OCTET-STREAM";
String Header = "Attachment; Filename=x.7z";
Response.AppendHeader("Content-Disposition", Header);
System.IO.FileInfo Dfile = new System.IO.FileInfo(Server.MapPath("~/x.7z"));
Response.WriteFile(Dfile.FullName);
//Don't forget to add the following line
Response.End();
}
In IIS you may want to set the MIME type as so:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With