views:

261

answers:

1

Using Visual Studio 2008 and built-in web server.

In a Web Handler .ashx file

    public void ProcessRequest(HttpContext context) {

        context.Response.ContentType = MimeType_text_xvcard;
        context.Response.Headers.Add(HttpHeader_ContentLength, "2138");

when I try to add an HTTP header I get the exception:

This operation requires IIS integrated pipeline mode.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.PlatformNotSupportedException: This operation requires IIS integrated pipeline mode.

I can find information about this error on the Internet but need specific info about how to presumably enable Integrated Pipeline mode (through web.config?) to allow HTTP headers to be manipulated.

How do do I put the built-in web server into integrated pipeline mode? Note: Not using full-fledged IIS

+2  A: 

Hi, Try replacing

context.Response.Headers.Add 

with

context.Response.AddHeader

(courtesy of this site)

I believe you have to be running IIS7 (in Integrated Pipeline mode) to use Headers.Add

keyboardP
Thank you. What a relief.
John K