从响应中删除不需要的标头 [英] Remove Unwanted headers from the response

查看:171
本文介绍了从响应中删除不需要的标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用c#创建了处理程序应用程序,这些处理程序正在被某些来源访问,例如(Abc.ashx?id = 0)。所以我在这里回复状态代码作为回应,但是其他一些额外的标题与状态代码一起发送。



我已经浏览了堆栈上的链接 - 溢出的解决方案,并能够从resposne中删除一些标题。



之前的响应包含以下标题: -

I have created the handler application using c# and these handlers are being accessed by the some source for e.g (Abc.ashx?id=0). So here I was returning the status code in response but some other extra headers were being sent along with the status code.

I have gone through the links over the stack-overflow for the solution and got able to remove some of the headers from the resposne.

Earlier the Response were containing below headers:-

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/plain; charset=utf-8
Expires: -1
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 31 Mar 2014 07:42:13 GMT
Content-Length: 12



现在尝试了一些解决方案后,新的回复: -


Now after trying some solution here is the new response:-

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Date: Mon, 31 Mar 2014 07:45:48 GMT



我的要求是在响应中仅发送状态代码。



所以我想删除/如果可能,请从响应中隐藏日期和转移编码。



提前感谢您的帮助。


My requirement here is to send only Status code in the response.

So I would like to remove/hide "Date" and "Transfer-Encoding" from the response if that is possible.

Thanks in advance for any help.

推荐答案

这篇关于从响应中删除不需要的标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆