The download code is required to set Response.ContentType = "Application/octet-stream",
Do not set the Application/x-msdownload to Applicatoin/octet-stream (this format represents any binary data),
ContentType is used to define how the user's browser or related device Displays the data that will be loaded.
The code is as follows:
Private Static voidRendertobrowser (byte[] Bytes, HttpContext context,stringdownloadname) { if(Context. Request.Browser.Browser = ="IE") {Downloadname= Httputility.urlencode (Downloadname, System.Text.Encoding.UTF8). Replace ("+","%20"); } context. Response.ContentType="Application/octet-stream"; Context. Response.AddHeader ("content-disposition","attachment;filename="+downloadname); Context. Response.BinaryWrite (bytes); Context. Response.Flush (); Context. Response.End (); }
The ". html" issue occurs when you download a document when Safari browser downloads