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

推荐订阅源

W
WeLiveSecurity
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
The Register - Security
The Register - Security
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
S
SegmentFault 最新的问题
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
AI
AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
U
Unit 42
腾讯CDC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
H
Help Net Security
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
博客园 - 聂微东
S
Securelist
大猫的无限游戏
大猫的无限游戏
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog

博客园 - 毛小华

如果数据库的处理(逗号) 今天碰到了http/1.1 403 Forbidden错误,处理如下 防止多次提交的几个比较 - 毛小华 - 博客园 SQL server 产生按日期排序的编号 sql数据库的连接的一句话(今天花了一个小时想明白的就记下来了) 一棵树 Bom树 一个自己测试通过的操作EXCEL 一个自己测试通过的发邮件操作 - 毛小华 - 博客园 控制界面是否可输入的一个例子 - 毛小华 - 博客园 今天电脑中毒了 WebPanelBar的使用 AlertButton 一个经验 一些感觉。 sql 语句中where条件和jion on条件的区别 asp.net 的经验 出现怪事啦,大家看啦 erp的设计经验 如果输入的dll名字被改后应该手工删除dll
一个很简单的操作excel的例子 - 毛小华 - 博客园
毛小华 · 2006-01-03 · via 博客园 - 毛小华

第三天了,总于解决了
是web.config中的一句话去掉就行了
    <identity impersonate="true"/>

代码不能运行产生问题:
我的机子上可以,服务器不能运行。现象是oledb不能Open();总是出错

贴出代码:

        private void SaveToExcel()
        
{

            
string urlPath = HttpContext.Current.Request.ApplicationPath + "/Temp/";

            
string physicPath = HttpContext.Current.Server.MapPath(urlPath);

            
string fileName = Guid.NewGuid() + ".Xls"

            
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + physicPath + fileName +";Extended Properties=Excel 8.0;";

            OleDbConnection objConn 
= new OleDbConnection(connString);
            OleDbCommand objCmd 
= new OleDbCommand();
            objCmd.Connection 
= objConn;
            objConn.Open();



            
//建立表结构

            objCmd.CommandText 
= @"CREATE TABLE TBL_Customer (CustomerName varchar,CustomerNo varchar)";

            objCmd.ExecuteNonQuery();

            objCmd.CommandText 
= "INSERT INTO TBL_Customer(CustomerName, CustomerNo) VALUES ('毛小华', 'good')";

            objCmd.ExecuteNonQuery();

            
//提供下载

            objCmd.Dispose();
            objConn.Dispose();
            

            HttpResponse response 
= HttpContext.Current.Response; 
            response.Clear();
            response.WriteFile(physicPath 
+ fileName);
            
string httpHeader="attachment;filename=backup.Xls";
            response.AppendHeader(
"Content-Disposition", httpHeader);
            response.Flush();

            System.IO.File.Delete(physicPath 
+ fileName);//删除临时文件
            response.End();        
        
        }


        
private void Button1_Click(object sender, System.EventArgs e)
        
{
            
//StartOutPort();
            
            SaveToExcel();
        }

处理步骤,查了很多文章,做了很多步骤:
1、怀疑权限,把Temp的权限设置了完全,不行!
2、怀疑mdac,jet等engine有问提,就重装了,不行!
3、索性sql sp3, 和 window  sp4, 等所有可安装的补丁重新装一边,还是不行。
4、有说IIS, 和匡架有可能,就把iis和frame work 1.1都重新安装了一边,还是不行,。
5、郁闷,睡觉了再想,重新建新工程 , 哈哈 ok, 拷入旧ws.config  出错。
呵呵,一个一个比较,就得到    <identity impersonate="true"/>是有问题的。

总结:
我的机子是fat32的权限要求不高 能够运行。
服务器是ntfs的权限要求高,