ASP.NET 1.1 中的 HttpHeader

发布于 2024-07-06 06:40:14 字数 183 浏览 8 评论 0原文

如何读取页面中发送的响应标头? 我希望能够读取标头值并修改其中的一些值。 这是针对 ASP.NET 1.1 应用程序的,但我很想知道它是否可以在任何版本的 ASP.NET 中完成。 这样做的原因是有人可能在我检查响应之前添加了自己的自定义标头 - 所以我不能盲目地清除所有标头并附加我自己的标头 - 我需要读取所有标头,以便我可以修改仅适用的。

How do I read the Response Headers that are being sent down in a page ? I want to be able to read the header values and modify some of them. This is for an ASP.NET 1.1 application but I would be curious to know if it can done in any version of ASP.NET.
The reason for doing this is someone may have added custom headers of their own before the point I am examining the response - so I cannot blindly clear all the headers and append my own - I need to read the all the headers so I can modify the appropriate ones only.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

合久必婚 2024-07-13 06:40:14

HttpContext.Current.Response(它是一个 HTTPResponse),公开了 ClearHeaders()、AddHeaders() 和 AppendHeaders()。

不像现在的 ASP.NET 更高版本中那样直接,但应该足以让您修改想要修改的标头。

http://msdn.microsoft.com /en-us/library/system.web.httpresponse_members(VS.71).aspx

HttpContext.Current.Response (Its a HTTPResponse), exposed ClearHeaders(), AddHeaders() and AppendHeaders().

Not as direct as it is now in later version of ASP.NET, but should be enough to let you modify the headers you wanted to modify.

http://msdn.microsoft.com/en-us/library/system.web.httpresponse_members(VS.71).aspx

最终幸福 2024-07-13 06:40:14

AFAIK 在 ASP.NET 1.1 中无法完成此操作。 您无法获取响应标头 - 请求标头可用,但响应标头不可用。
我不确定你是否可以在 Java、LAMP 等其他堆栈中执行此操作,我很想知道......

AFAIK it cannot be done in ASP.NET 1.1. There is no way for you to get at the response headers - request headers are available but not response headers.
I am not sure if you can do this in other stacks like Java, LAMP though and I am curious to find out...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文