Processing simple post data, not form data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • eselk2003@gmail.com

    Processing simple post data, not form data

    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.BinaryR ead, or Request.InputSt ream,
    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.InputSt ream to some
    string reader class already designed for reading one line at a time?
  • bruce barker

    #2
    Re: Processing simple post data, not form data

    using (var sr = new StreamReader(Re quest.InputStre am))
    {
    while (!sr.EndOfStrea m)
    {
    Response.Write( sr.ReadLine() + "<br/>");
    }
    }


    -- bruce (sqlwork.com)


    eselk2003@gmail .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.BinaryR ead, or Request.InputSt ream,
    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.InputSt ream to some
    string reader class already designed for reading one line at a time?

    Comment

    • eselk2003@gmail.com

      #3
      Re: Processing simple post data, not form data

      I'm guessing I can probably convert/cast Request.InputSt ream to some
      string reader class already designed for reading one line at a time?
      >On Oct 24, 7:02 pm, bruce barker <nos...@nospam. comwrote:
            using (var sr = new StreamReader(Re quest.InputStre am))
            {
               while (!sr.EndOfStrea m)
               {
                  Response.Write( sr.ReadLine() + "<br/>");
               }
            }
      >
      -- bruce (sqlwork.com)
      Thank you, exactly what I was looking for.

      Comment

      Working...