博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Why does Http header contains "X-SourceFiles"?
阅读量:4511 次
发布时间:2019-06-08

本文共 1370 字,大约阅读时间需要 4 分钟。

Question:

Using a FileStreamResult in ASP.NET MVC 3, I get a response header like

X-SourceFiles =?UTF-8?B?RDpcUHJvamVjdFxqYWNvYlx0ZXN0?=

 

Answer:

The header is understood by certain debugging modules in IIS / IIS Express. It contains the base64-encoded path to the source file on disk and is used to link a page's generated output back to that source file. It's only generated for localhost requests, so you don't need to worry about it being displayed to the world when you deploy the application to an actual server.

 

Updated:

It is not the root cause. I re-checked this issue. only IE has this problem, Chrome is ok. It is caused by the Chinese file name. if the file name doesn't have double byte char, all are ok.  The workaround is to escape the file name when client browser is IE

...    string bName = HttpContext.Current.Request.Browser.Browser;            if (bName  == "InternetExplorer")            {                fileName = Uri.EscapeDataString(fileName);            }

  result.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");

  result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

  result.Content.Headers.ContentDisposition.FileName = fileName;

  result.Content.Headers.Add("x-filename", fileName);

...

 

转载于:https://www.cnblogs.com/xixifusigao/p/3953279.html

你可能感兴趣的文章
mybatis--面向接口编程
查看>>
保护您眼睛视力 请对Win7/Vista/xp作如下设置
查看>>
Oracle 统计信息窗口的相关知识
查看>>
Pollard-Rho大整数拆分模板
查看>>
uva11429(生成随机数 期望)
查看>>
sublime 安装ctags跳转以及跳转快捷键
查看>>
Unity3D的单例模式
查看>>
链表的基本使用
查看>>
大批量数据导出到Excel的实现
查看>>
Cortex M3 - STM32 Developing with GCC Tools
查看>>
基于模糊集理论的一种图像二值化算法
查看>>
mysql_connect 弃用之后使用mysqli替换需要注意事项
查看>>
CentOS7安装MySQL
查看>>
vue状态管理
查看>>
DOM方式创建XML文件
查看>>
理解Call、Apply、bind
查看>>
硬链接和软链接
查看>>
汉诺塔
查看>>
Python——thread
查看>>
Python网络编程(4)——异步编程select & epoll
查看>>