zoukankan      html  css  js  c++  java
  • ashx

    前端调用

          window.location.href = "192.168.100.18/OutExcel/YJZHStatistics.ashx?code=" + code + "&Token=" + token + "&filename=" + filename + "&browserType=" + browserType;
     public void ProcessRequest(HttpContext context)
            {    
                string guid = HttpContext.Current.Request.Params["guid"];
                string browserType = HttpContext.Current.Request.Params["browserType"];
                string filename = "";
                byte[] bytes;   //将excel转成byte        
                context.Response.Clear();
                context.Response.ContentType = "application-excel";
                if (browserType == "fireFox")
                {
                    context.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlDecode(filename, System.Text.Encoding.UTF8) + ".xlsx");
                }
                else
                {
                    context.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8) + ".xlsx");
                }
                HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
                HttpContext.Current.Response.Charset = "UTF-8";
                context.Response.BinaryWrite(bytes);
                context.Response.Flush();
                context.Response.Close();
            }
  • 相关阅读:
    时间工时累加
    python读取mnist
    开始学习haskell
    pip升级所有packages
    ImportError: numpy.core.multiarray failed to import
    NumPy for MATLAB users
    Spyder
    初学ObjectiveC
    Matlab闭包
    ObjeciveC 内存管理
  • 原文地址:https://www.cnblogs.com/macT/p/12068660.html
Copyright © 2011-2022 走看看