Wednesday, February 20, 2008

This operation requires IIS integrated pipeline mode







If you're getting an error message

This operation requires IIS integrated pipeline mode

when trying to add headers to a HttpResponse object in an ASP.Net web application, chances are you're trying something like this:

response.Headers["myHeader"] = "someValue";

or

response.Headers.Add("myHeader", "someValue");

A quick Google reveals mentions of bugs in the 3.5 framework, but I'm using .Net 2. Nevertheless you can work around this problem by adding your header this way instead:

response.AddHeader("myHeader", "someValue");

And your code should now add the header successfully.

27 comments:

Anonymous said...

Thanks, I just got this error and your explanation was very helpful.

gerely said...

Thanks, it helped!
G.

Warappa said...

Thanks for helping with this weird problem!

Anonymous said...

I had the same problem. This worked like a charm.

Alan said...

Very good, thanks.

Sune Trudslev said...

Excellent. Thanks for the quick fix!

Anonymous said...

How about reading the header? Get the same error. Anyone konew of a workaround?

Anonymous said...

Awesome Thanks a lot,
I spent ages finding a solution to this issue.

Anonymous said...

Thanks for writing this up, very helpful.

Anonymous said...

Thnx

Anonymous said...

Thanks:) Helped:)

Anonymous said...

Just what I needed - thanks.

Rush said...

thanks!

Anonymous said...

Thanks!!!!

Anonymous said...

Thanks!

Pete said...

Great explanation, just what I wanted. Thanks!

Anonymous said...

or,

you can use response.AppendHeader("key", "value");

response.header is readonly for application.

Anonymous said...

The meta-tag did solution for the rendering didn't work. So I tried Headers.Add() and got the error you describe.
You saved my ass, thanks for posting this!

Ates Goral said...

Thanks for this post!

hidha said...

Thanks, it was helpful.

Alok Kumar said...

It was helpful.

Anonymous said...

thanks

Anonymous said...

Thanks for the quick fix!

jhumphry said...

Hey, thanks for this article, it was a major time saver!

Anonymous said...

Thanks, it really helped

Anonymous said...

I am new to .net, and trying to learn the membership class. I am getting the same message when I tried to use the Membership.ValidateUser(). It always failed, and I noticed the following message that was described above. Since I am using the Membership.ValidateUser(), how do I add the the header that would prevent this error message.

Anonymous said...

Thanks Great jobs................