Processing simple post data, not form data

Discussion in 'ASP .Net' started by eselk2003@gmail.com, Oct 25, 2008.

  1. Guest

    I have a Windows application that uses the Windows Internet (wininet)
    API to post a few lines of text to an ASP.NET page that I'm writing.
    I know how to process form data in ASP.NET, but not sure how to
    process simple lines of text. I'm a C++ Win32 programmer and have
    lots to learn about .NET, and VB.NET.

    I imagine I need to use Request.BinaryRead, or Request.InputStream,
    and I'm sure I could figure out some way to kludge something together
    that looks a lot like what I would do in native C++... but I'm sure I
    really only need to write a few lines of code and that those few lines
    would work much better.

    The post data is just several strings, seperated by line-feeds (vbCrLf
    OR \r\n), like this:

    hello
    test
    whatever
    thanks

    I just want to loop through those lines and add each one to my
    database. I know how to handle the database part.

    I'm guessing I can probably convert/cast Request.InputStream to some
    string reader class already designed for reading one line at a time?
    , Oct 25, 2008
    #1
    1. Advertising

  2. bruce barker Guest

    using (var sr = new StreamReader(Request.InputStream))
    {
    while (!sr.EndOfStream)
    {
    Response.Write(sr.ReadLine() + "<br/>");
    }
    }


    -- bruce (sqlwork.com)


    wrote:
    > I have a Windows application that uses the Windows Internet (wininet)
    > API to post a few lines of text to an ASP.NET page that I'm writing.
    > I know how to process form data in ASP.NET, but not sure how to
    > process simple lines of text. I'm a C++ Win32 programmer and have
    > lots to learn about .NET, and VB.NET.
    >
    > I imagine I need to use Request.BinaryRead, or Request.InputStream,
    > and I'm sure I could figure out some way to kludge something together
    > that looks a lot like what I would do in native C++... but I'm sure I
    > really only need to write a few lines of code and that those few lines
    > would work much better.
    >
    > The post data is just several strings, seperated by line-feeds (vbCrLf
    > OR \r\n), like this:
    >
    > hello
    > test
    > whatever
    > thanks
    >
    > I just want to loop through those lines and add each one to my
    > database. I know how to handle the database part.
    >
    > I'm guessing I can probably convert/cast Request.InputStream to some
    > string reader class already designed for reading one line at a time?
    bruce barker, Oct 25, 2008
    #2
    1. Advertising

  3. Guest

    > > I'm guessing I can probably convert/cast Request.InputStream to some
    > > string reader class already designed for reading one line at a time?


    >On Oct 24, 7:02 pm, bruce barker <> wrote:
    >       using (var sr = new StreamReader(Request.InputStream))
    >       {
    >          while (!sr.EndOfStream)
    >          {
    >             Response.Write(sr.ReadLine() + "<br/>");
    >          }
    >       }
    >
    > -- bruce (sqlwork.com)


    Thank you, exactly what I was looking for.
    , Oct 27, 2008
    #3
    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. Jukka K. Korpela
    Replies:
    3
    Views:
    774
    Michael Winter
    Mar 6, 2004
  2. Michael Winter
    Replies:
    4
    Views:
    589
    Lasse Reichstein Nielsen
    Mar 6, 2004
  3. Robert
    Replies:
    0
    Views:
    511
    Robert
    Mar 6, 2004
  4. J. Muenchbourg
    Replies:
    0
    Views:
    357
    J. Muenchbourg
    Aug 6, 2003
  5. JRough
    Replies:
    2
    Views:
    147
    JRough
    Mar 31, 2009
Loading...

Share This Page