FileInfo fileinfo = new FileInfo(@"\\10.16.20.70\website.com\wwwroot\im_online.png"); Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AppendHeader("Content-Disposition", "attachment; filename =im_online.png "); Response.AppendHeader("Content-Length", fileinfo.Length.ToString()); Response.ContentType = "application/download"; Response.WriteFile(fileinfo.FullName); Response.Flush(); Response.Close(); Response.End();
Quote:The DownloadFile method downloads to a local file data from the URI specified by in the address parameter. This method blocks while downloading the resource. To download a resource and continue executing while waiting for the server's response, use one of the DownloadFileAsync methods.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)