Tuesday, July 22, 2008

Response.Headers.Add causes Requires IIS integrated pipeline mode exception

I tried to send a file back to the browser through an HTTP handler in ASP.NET, but came up with a "This operation requires IIS integrated pipeline mode" on the line where I'm setting the content-disposition header. It seemed quite odd because I was doing something similar in a previous ASP.NET application. After a bit of Googling, I came across the solution...

Using "context.Response.Headers.Add" was the culprit. I replaced the "context.Response.Headers.Add" with a "context.Response.AddHeader" and voila! Works like a charm.

4 comments:

misoH said...

ouch, I did the same, and this helped me :) thanks

Nitin R.K. said...

Considering how all the other classes are designed (such as Controls.Add or Items.Add), I thought Headers.Add seemed like the one I had to use.

Apparently not.

Saibi said...

I am also facing the same problem but the method you told is not solving my problem
I am getting the error on very first line
Response.clear();

Zdeněk Plachý said...

Thank you, it saved me a day