\nAnd it would be great if you can suggest some articles or book to know about properly using HTTP headers and verbs.
\n","author":{"@type":"Person","name":"Akina91"},"upvoteCount":3,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"If you want to write that variable directly to the response then you can simply call this in your Page_Load. This will avoid the IIS integrated pipeline mode requirement.
\n\nPage.Response.Write(Request.ServerVariables[\"ALL_HTTP\"]);\n
\n\nFor learning I would concentrate on learning about HTTP and REST.
\n\nReputation: 332
I am trying to add a custom Headers -> e1 HttpContext.Current.Response.AddHeader("e1","example of an exception");
to HTTP response in Page_Load method which works fine as I checked it in chrome developer tools.
The problem is if I am trying to write the same response using : HttpContext.Current.Response.Write(HttpContext.Current.Response.Headers["ALL_HTTP"].ToString());
it causes an PlatformNotSupportedException : This operation requires IIS integrated pipeline mode.
So the main question is how to read the added response header given I am using the inbuilt VS development server?
And it would be great if you can suggest some articles or book to know about properly using HTTP headers and verbs.
Upvotes: 3
Views: 1193
Reputation: 3149
If you want to write that variable directly to the response then you can simply call this in your Page_Load. This will avoid the IIS integrated pipeline mode requirement.
Page.Response.Write(Request.ServerVariables["ALL_HTTP"]);
For learning I would concentrate on learning about HTTP and REST.
Upvotes: 2