by the time ProcessRequest is called my POST has turned into a GET RRS feed

  • Question

  • User-216871512 posted


    I've created a HttpHandler that uses POX for input and output.

    Calling code:

    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(handlerUrl);				

    req.ContentType = "text/xml;charset=\"utf-8\"";
    req.Accept = "text/xml";
    req.Method = "POST";
    Stream stm = req.GetRequestStream();

    WebResponse resp = req.GetResponse();
    Handler Code:
    public void ProcessRequest(HttpContext context)
    myInputXmlDocument = new XmlDocument();


     Here's the problem, when a breakpoint is hit inside ProcessRequest, context.Request.RequestType = "GET" not "POST" and the InputStream has a length of zero.

     Changes to web.config's HttpHandler section have made no difference.

     What's going wrong? Ideas appreciated.


    Friday, June 1, 2007 10:37 AM


  • User-216871512 posted

    I solved it myself. The problem was that the cookieless attribute of the sessionState tag in web.config was set to "AutoDetect".

    When set to autodetect sometimes the framework tells the calling client to redirect back to the same page. It was that redirected request (a GET) that was finally getting to my ProcessRequest method.

    Here's a more thorough explanation  

    If I had only thought to check context.Request.QueryString, I would have found "?AspxAutoDetectCookieSupport=1" and probably solved my problem a lot quicker.

    Oh well, hopefully this post will save someone else some time.


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 1, 2007 3:03 PM