首页新闻找找看学习计划

苹果浏览器下载文件自动带后缀.html

0
悬赏园豆:20 [已关闭问题] 关闭于 2012-05-05 15:09

问题:我的网站一个下载功能在其他浏览器上都没有问题!但是在苹果电脑上下载下来的文件会自动加上后缀.html   请教高手解决!

一下是下载文件的代码片段:

 WebClient webClient = new WebClient();

            HttpContext.Current.Response.BufferOutput = false;             HttpContext.Current.Response.Clear();             HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + ReadConfig.GetCurrentTimeWu() + ".png");             //HttpContext.Current.Response.ContentType = "";             //application/octet-stream";             HttpContext.Current.Response.CacheControl = "Private";             Stream stm = new MemoryStream(webClient.DownloadData(destFileName));             HttpContext.Current.Response.AppendHeader("Content-length", stm.Length.ToString());             BinaryReader br = new BinaryReader(stm);             byte[] bytes;             for (Int64 x = 0; x < (br.BaseStream.Length / 4096 + 1); x++)             {                 bytes = br.ReadBytes(4096);                 HttpContext.Current.Response.BinaryWrite(bytes);                 System.Threading.Thread.Sleep(5);  //休息一下,防止耗用带宽太多。             }             stm.Close();

迷恋郭德纲的主页 迷恋郭德纲 | 初学一级 | 园豆:67
提问于:2012-01-10 17:13
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册