if (pUploadData != null) { //下载 //以字符流的形式下载文件 Response.ContentType = "application/octet-stream"; //获取浏览器类型 string strUserAgent = GTSoft.Web.Common.CommonFunction.GetString(Request.ServerVariables["http_user_agent"]); if (strUserAgent.ToLower().IndexOf("firefox") == -1) {//非火狐浏览器 Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(strMediaName, System.Text.Encoding.UTF8)); } else {//火狐浏览器 Response.AddHeader("Content-Disposition", "attachment; filename=" + strMediaName); } Response.BinaryWrite(pUploadData); Response.Flush(); Response.End(); }