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

推荐订阅源

N
News and Events Feed by Topic
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
Jina AI
Jina AI
H
Help Net Security
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Vercel News
Vercel News
L
LangChain Blog
Recorded Future
Recorded Future
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
I
InfoQ
GbyAI
GbyAI
B
Blog RSS Feed
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
M
MIT News - Artificial intelligence
爱范儿
爱范儿
V
V2EX
Microsoft Azure Blog
Microsoft Azure Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Y
Y Combinator Blog
B
Blog
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
W
WeLiveSecurity
MongoDB | Blog
MongoDB | Blog
Cloudbric
Cloudbric
N
News and Events Feed by Topic
The Cloudflare Blog
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
D
DataBreaches.Net
博客园 - 【当耐特】
T
Troy Hunt's Blog
V
Visual Studio Blog
V2EX - 技术
V2EX - 技术
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google Online Security Blog
Google Online Security Blog
The GitHub Blog
The GitHub Blog

博客园 - Bireyou

Visual Studio 更改护眼颜色 修复SQL中的孤立账户 在SQL中查看文件组中有哪些表 出现“尝试读取或写入受保护的内存。这通常指示其他内存已损坏”的解决方法 Ext.Net开发过程中问题集锦 SQL Server 2005 中重建Master数据库 NUnit2.0详细使用方法 如何配置和部署安全的.NET三层应用 ASP.NET如何在客户端调用服务端代码 ASP.NET 2.0 绑定高级技巧 - Bireyou 把.NET程序部署到没有安装.NET Framwork的机器上 SourceGrid 2.0 认识ASP.NET配置文件Web.config 加密Web.config中的信息 DataGrid中创建复杂表头方法 showModalDialog()、showModelessDialog()详解 每一项都是js中的小技巧,但十分的实用! 在ASP.NET页面间传递任意数据的方法与实例 javascript函数库
ASP.NET实现下载的中文文件名乱码处理 - Bireyou - 博客园
Bireyou · 2006-01-06 · via 博客园 - Bireyou

引用:http://dotnet.chinaitlab.com/ASPNET/35677.html
  早几天在系统中添加文件管理的下载功能, 要求在ASPX文件中实现, 以进行权限的控件,于是添加下列代码:
  ...
  Response.ContentType = mime; //相应的MIME TYPE
  Response.AppendHeader("Content-Disposition", "attachment; filename=\"" +fileName + "\"");
  
  Response.BinaryWrite(bytes);
  Response.End();
  ...
  
  当fileName中包含中文时, 文件下载保存时, 文件名变成了乱码, 需要用户修改,这也就违被了我设定预设文件名的初衷.
  
  解决办法1: 对fileName进行URL编码, 把下划线标注的那句改为Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + Server.UrlEncode(fileName) + "\"");便可.
  
  虽然中文乱码问题解决了, 但是还有一个问题: 在测试时, 下载保存的文件名有时会变成该页面的名字(.aspx), 虽然可以把内容下载到本地, 但是需要更改文件名及类型, 这样会给用户带来很大的困惑.
  
  还有一个办法, 可以很简单的解决以上的两个问题:
  
  解决办法2: 假设当前的URL为 http://localhost/download.aspx?id=123, fileName为"下载.pdf", 我们只要把下载URL改为 http://localhost/download.aspx/下载.pdf?id=123 可, 上面下划线标注的那句代码则可以注释掉了, 试一下, 结果一定让你非常满意!