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

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

博客园 - 毛小华

如果数据库的处理(逗号) 今天碰到了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的权限要求高,