How to Peek at Entire HttpRequest.InputStream?

Discussion in 'ASP .Net' started by samtilden@gmail.com, Jun 21, 2006.

  1. Guest

    I want to print out some tracing messages from
    Global.asax.cs/Application_BeginRequest().

    I easily got:

    System.Web.HttpContext.Current.Request.RawUrl, and
    System.Web.HttpContext.Current.Request.Params["HTTP_SOAPACTION"].


    I would now like to get the entire:

    System.Web.HttpContext.Current.Request.InputStream

    .... and reset the InputStream back to the beginning so that the rest of
    our application will continue to work as before.


    I've tried doing:

    Request.BinaryRead(length),
    Request.InputStream.Position = 0,
    Request.InputStream.Seek(0,SeekOrigin.Begin),

    but none of them reset the stream pointer back to the beginning.

    How can I peek at the _entire_ HttpRequest.InputStream _and_ leave it
    untouched?
     
    , Jun 21, 2006
    #1
    1. Advertising

  2. its a firehose stream, so you can not reset it. you can write you own
    handler, then buffer the stream, by reading and writing to another stream
    the the request uses.

    <> wrote in message
    news:...
    >I want to print out some tracing messages from
    > Global.asax.cs/Application_BeginRequest().
    >
    > I easily got:
    >
    > System.Web.HttpContext.Current.Request.RawUrl, and
    > System.Web.HttpContext.Current.Request.Params["HTTP_SOAPACTION"].
    >
    >
    > I would now like to get the entire:
    >
    > System.Web.HttpContext.Current.Request.InputStream
    >
    > ... and reset the InputStream back to the beginning so that the rest of
    > our application will continue to work as before.
    >
    >
    > I've tried doing:
    >
    > Request.BinaryRead(length),
    > Request.InputStream.Position = 0,
    > Request.InputStream.Seek(0,SeekOrigin.Begin),
    >
    > but none of them reset the stream pointer back to the beginning.
    >
    > How can I peek at the _entire_ HttpRequest.InputStream _and_ leave it
    > untouched?
    >
     
    bruce barker \(sqlwork.com\), Jun 21, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. R
    Replies:
    5
    Views:
    2,148
    Kevin McMurtrie
    Mar 13, 2005
  2. Pelle
    Replies:
    5
    Views:
    1,487
    Attila Feher
    Sep 19, 2003
  3. kill sunday

    cin.peek()

    kill sunday, Oct 19, 2003, in forum: C++
    Replies:
    1
    Views:
    3,047
    Jerry Coffin
    Oct 21, 2003
  4. Suresh
    Replies:
    2
    Views:
    1,132
  5. Replies:
    0
    Views:
    1,494
Loading...

Share This Page