惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
N
News and Events Feed by Topic
P
Privacy International News Feed
The Hacker News
The Hacker News
Schneier on Security
Schneier on Security
C
Cybersecurity and Infrastructure Security Agency CISA
Security Latest
Security Latest
L
LINUX DO - 最新话题
阮一峰的网络日志
阮一峰的网络日志
Cisco Talos Blog
Cisco Talos Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
The Cloudflare Blog
博客园 - 【当耐特】
博客园 - Franky
P
Privacy & Cybersecurity Law Blog
Attack and Defense Labs
Attack and Defense Labs
云风的 BLOG
云风的 BLOG
月光博客
月光博客
D
Docker
Webroot Blog
Webroot Blog
The GitHub Blog
The GitHub Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
W
WeLiveSecurity
S
Security Affairs
Martin Fowler
Martin Fowler
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Archives - TechRepublic
Security Archives - TechRepublic
Microsoft Azure Blog
Microsoft Azure Blog
C
CERT Recently Published Vulnerability Notes
B
Blog
L
Lohrmann on Cybersecurity
T
Threatpost
量子位
S
Schneier on Security
V
Visual Studio Blog
S
Securelist
T
The Exploit Database - CXSecurity.com
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
aimingoo的专栏
aimingoo的专栏
The Register - Security
The Register - Security
I
Intezer
Stack Overflow Blog
Stack Overflow Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园 - 聂微东
小众软件
小众软件
罗磊的独立博客
雷峰网
雷峰网
Recorded Future
Recorded Future

博客园 - Michael.li

excel中使用sum函数计算包含小数列,结果出现多位小数值 使用 SqlBulkCopy 向 destinationTableName 表插入数据 使用Wireshark抓包QQ聊天用户IP地址 MSSQL数据库设计心得 Html5大文件断点续传 c# 使用protobuf格式操作 Redis Web网站架构设计 extjs中的tabpanle下的combobox提交问题 Asp.net下from认证统一认证配置 Extjs 4.07 对类型定义引发的匹配问题 Supesoft权限管理系统(FrameWork) 1.0.9 Release 手机6120C 玩仙剑dos版 ASP.NET权限管理系统(FrameWork) 1.0.8 Release ASP.NET权限管理系统(FrameWork) 1.0.7 Release 广告统计分析系统(ADCount) 1.0.0 Beta DDBuildTools 1.3.0 Release发布 ASP.NET权限管理系统(FrameWork) 1.0.6 Release remoting缓存设计总结 - Michael.li - 博客园 ASP.NET权限管理系统(FrameWork) 1.0.5 Release
关于在Page_Load定义外部变量输出 - Michael.li - 博客园
Michael.li · 2008-12-27 · via 博客园 - Michael.li

string cmd = (string)Common.sink("cmd", MethodType.Get, 255, 0, DataType.Str);      

  protected void Page_Load(object sender, EventArgs e)
        {

            if (cmd == "DownLoad")
            {
                DownXslFile();
            }

        }

/// <summary>
        /// 导出Excel文档
        /// </summary>
        protected void DownXslFile()
        {


            System.IO.StringWriter sw = new System.IO.StringWriter();

            Server.Execute("report.aspx?cmd=ssss", sw, false);
            string abcd = sw.ToString();
            string fileName = "考勤报表_" + DateTime.Now.Date.ToString("yyyyMMdd") + ".xls";

            //Response.Headers.Clear();
            Response.Clear();
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName));
            Response.Charset = "utf-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = "application/ms-excel";
            Response.Write(abcd.ToString());
            Response.End();
        }

 发现生成的文件内容为空.

后来将string cmd = (string)Common.sink("cmd", MethodType.Get, 255, 0, DataType.Str);      放入page_load方法中才成功.

如下:

  protected void Page_Load(object sender, EventArgs e)
        {

          string cmd = (string)Common.sink("cmd", MethodType.Get, 255, 0, DataType.Str);      

            if (cmd == "DownLoad")
            {
                DownXslFile();
            }

        }