ASP.NET 1.1 中的 HttpHeader
如何读取页面中发送的响应标头? 我希望能够读取标头值并修改其中的一些值。 这是针对 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
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
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...