private bool downfile(HttpResponse response,string fullpath) { string saveFileName = ""; int intStart = fullpath.LastIndexOf("//") + 1; saveFileName = fullpath.Substring(intStart, fullpath.Length - intStart); System.IO.FileInfo fi = new System.IO.FileInfo(fullpath); string fileextname = fi.Extension; string DEFAULT_CONTENT_TYPE = "application/unknown"; string filecontenttype= DEFAULT_CONTENT_TYPE; response.Clear(); response.Charset = "utf-8"; response.Buffer = true; this.EnableViewState = false; response.ContentEncoding = System.Text.Encoding.UTF8; response.AppendHeader("Content-Disposition", "attachment;filename=" + saveFileName); response.ContentType = filecontenttype; response.WriteFile(fullpath); response.Flush(); response.Close(); response.End(); }