【发布时间】:2012-12-03 20:53:26
【问题描述】:
我正在尝试在 Page_Load 方法中添加自定义标头 -> e1 HttpContext.Current.Response.AddHeader("e1","example of an exception"); 到 HTTP 响应,当我在 chrome 开发人员工具中检查它时效果很好。
问题是如果我尝试使用以下方式编写相同的响应:HttpContext.Current.Response.Write(HttpContext.Current.Response.Headers["ALL_HTTP"].ToString());
它会导致 PlatformNotSupportedException :此操作需要 IIS 集成管道模式。
所以主要问题是如果我使用的是内置的 VS 开发服务器,如何读取添加的响应标头?
如果您能推荐一些关于正确使用 HTTP 标头和动词的文章或书籍,那就太好了。
【问题讨论】:
标签: asp.net http http-headers webforms