3

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.

U+25BC

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.

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.