Why does Http header contains "X-SourceFiles"?
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);
...
Why does Http header contains "X-SourceFiles"?的更多相关文章
- RestTemplate发送请求并携带header信息
1.使用restTemplate的postForObject方法 注:目前没有发现发送携带header信息的getForObject方法. HttpHeaders headers = new Http ...
- ABP Zero示例项目登录报错“Empty or invalid anti forgery header token.”问题解决
ABP Zero项目,登录时出现如图"Empty or invalid anti forgery header token."错误提示的解决方法: 在 WebModule.cs的P ...
- ASP.NET MVC 3 网站优化总结(三)Specify Vary: Accept-Encoding header
继续进行 ASP.NET MVC 3 网站优化工作,使用 Google Page 检测发现提示 You should Specify Vary: Accept-Encoding header,The ...
- .htaccess添加Header set Cache-Control报错500
在优化网站开启站点的图片缓存时,需要在.htaccess文件中加入: #文件缓存时间配置10分钟 <FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf ...
- 如何实现可动态调整隐藏header的listview
(转自:http://blog.sina.com.cn/s/blog_70b9730f01014sgm.html) 需求:根据某种需要,可能需要动态调整listview的页眉页脚,譬如将header作 ...
- PHP header函数设置http报文头(设置头部域)
PHP HTTP 简介: HTTP 函数允许您在其他输出被发送之前,对由 Web 服务器发送到浏览器的信息进行操作. PHP 5 HTTP 函数:header() 向客户端发送原始的 HTTP ...
- 【HTML5&CSS3进阶学习02】Header的实现·CSS中的布局
前言 我们在手机上布局一般是这个样子的: 其中头部对整个mobile的设计至关重要,而且坑也很多: ① 一般来说整个header是以fixed布局,fixed这个产物在移动端来说本身坑就非常多 ② 在 ...
- webservice客户端添加soap Header信息
根据wsdl文件的header信息,在客户端中添加相应的header 1.wsdl信息如图 <soapenv:Envelope xmlns:soapenv="http://schema ...
- HTTP Header 详解
HTTP(HyperTextTransferProtocol)即超文本传输协议,目前网页传输的的通用协议.HTTP协议采用了请求/响应模型,浏览器或其他客户端发出请求,服务器给与响应.就整个网络资源传 ...
- java.lang.IllegalStateException: Cannot add header view to list -- setAdapter has already been called.
分析:android 4.2.X及以下的版本,addHeaderView必须在setAdapter之前,否则会抛出IllegalStateException. android 4.2.X(API 17 ...
随机推荐
- java中正则表达式常用方法
一.匹配 String matches()方法.用规则匹配整个字符串,只要有一处不符合规则,就匹配结束,返回false. 举例: public static void checkQQ(){ Stri ...
- 属性动画和Activity、Fragment过渡动画等
主题是关于动画的,但是不是什么动画的内容都包括.先泛泛的介绍一下,然后详细的介绍一下翻代码找见的一个好玩的动画的使用.以下的内容包括Android 3和Android 3.1等引入的API,在使用中请 ...
- Qt_MainWindow简介
QMainWindow 是Qt框架带来的一个预定义好的主窗口类.按照建立HelloWorld程序建立工程,直接运行,或有一个空窗口. main().cpp #include "mainwin ...
- Jmeter-连接 MySQL数据库
一.下载mysql驱动包,mysql各个版本驱动包如下: http://central.maven.org/maven2/mysql/mysql-connector-java/ (上面链接的信息来源于 ...
- Hdu4135 Co-prime 2017-06-27 16:03 25人阅读 评论(0) 收藏
Co-prime Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Subm ...
- js-图片时间(倒计时)
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> ...
- 类变量的初始化时机(摘录自java突破程序员基本功德16课)
先看书本的一个例子,代码如下: public class Price { final static Price INSTANCE=new Price(2.8); static double initP ...
- [javascript]Three parts of javascript code snippet
<script> (function(){ /* if (navigator.userAgent.toLowerCase().indexOf("iphone") == ...
- unigui的编译部署
unigui的编译部署 unigui既可以EXE形态部署,也可以IIS的ISAPI的形态部署.关键在工程文件.dpr里面的编译开关. {$define UNIGUI_VCL} // 注释此编译开关将使 ...
- FFmpeg4.0笔记:file2rtmp
Github: https://github.com/gongluck/FFmpeg4.0-study.git #include <iostream> using namespace st ...