我正在尝试在Page_Load方法中添加自定义 Headers -> e1 HttpContext.Current.Response.AddHeader("e1","example of an exception");
到HTTP响应中,通过在chrome开发工具中检查,这个功能可以正常工作。
问题是如果我试图使用下面的代码来写入相同的响应: HttpContext.Current.Response.Write(HttpContext.Current.Response.Headers["ALL_HTTP"].ToString());
,会引发PlatformNotSupportedException : This operation requires IIS integrated pipeline mode.
所以主要问题是如何读取添加的响应标头,假设我正在使用内置的VS开发服务器?
如果您能够建议一些文章或书籍来了解正确地使用HTTP头和动词,那就太好了。