Retrieve POST data from an HTML Form in asp.net

Discussion in 'ASP .Net' started by Danielle, Sep 17, 2007.

  1. Danielle

    Danielle Guest

    Hello all,
    I'm pretty new to asp.net, I've to do a quick port to ASP.net
    I've got a problem I cannot solve: cannot find anything helpfull on
    the web.
    I've got an HTML form generated from a software i cannot change, so
    the form must have to remain pure html.

    <form id="form_1" method="POST" action="process.aspx">
    <input type="text" id="field_1" value="" />
    </form>

    How do I have to build the process.aspx file to retrieve the field_1
    input?
    I tried with Request.Form['form_1'] but cannot get it, it still does
    not work.

    Please help me, thanks you all
    Danielle
     
    Danielle, Sep 17, 2007
    #1
    1. Advertising

  2. Danielle

    Nick Chan Guest

    hi there (me no expert)
    if the HTML form is valid XML, u can just use .net XML classes

    something like this

    dim x as new system.xml.xmldocument
    x.loadxml(thehtmlform)
    dim sValue as string =
    x.GetElementById("field_1").GetAttribute("value")

    On Sep 17, 9:37 am, Danielle <> wrote:
    > Hello all,
    > I'm pretty new to asp.net, I've to do a quick port to ASP.net
    > I've got a problem I cannot solve: cannot find anything helpfull on
    > the web.
    > I've got an HTML form generated from a software i cannot change, so
    > the form must have to remain pure html.
    >
    > <form id="form_1" method="POST" action="process.aspx">
    > <input type="text" id="field_1" value="" />
    > </form>
    >
    > How do I have to build the process.aspx file to retrieve the field_1
    > input?
    > I tried with Request.Form['form_1'] but cannot get it, it still does
    > not work.
    >
    > Please help me, thanks you all
    > Danielle
     
    Nick Chan, Sep 17, 2007
    #2
    1. Advertising

  3. Danielle

    marss Guest

    Danielle :

    > <form id="form_1" method="POST" action="process.aspx">
    > <input type="text" id="field_1" value="" />
    > </form>
    >
    > How do I have to build the process.aspx file to retrieve the field_1
    > input?


    Add runat="server" attribute. Retrieve value using of field_1.Value on
    server-side.
    <input type="text" id="field_1" value="" runat="server"/>

    Regards,
    Mykola
    http://marss.co.ua
     
    marss, Sep 17, 2007
    #3
  4. Danielle

    Danielle Guest

    Thanks you all!
    I solved in a different way, but your suggestion were really useful.

    My solution for the process.aspx page:

    <%@ Page Language="VB" %>
    <script runat="server">
    Sub Page_Load()
    Response.Write(Request.Form("field_1"))
    End Sub
    </script>

    It was simplier then i thought. Thanks again!
    Daniele
     
    Danielle, Sep 17, 2007
    #4
    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. Vishal
    Replies:
    1
    Views:
    678
    Steve C. Orr [MVP, MCSD]
    Dec 21, 2004
  2. Li Zhang
    Replies:
    4
    Views:
    6,088
    softip
    Feb 27, 2009
  3. Replies:
    5
    Views:
    1,074
  4. leoboiko
    Replies:
    0
    Views:
    385
    leoboiko
    Aug 6, 2008
  5. J. Muenchbourg
    Replies:
    0
    Views:
    368
    J. Muenchbourg
    Aug 6, 2003
Loading...

Share This Page