Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Retrieve POST data from an HTML Form in asp.net

Reply
Thread Tools

Retrieve POST data from an HTML Form in asp.net

 
 
Danielle
Guest
Posts: n/a
 
      09-17-2007
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

 
Reply With Quote
 
 
 
 
Nick Chan
Guest
Posts: n/a
 
      09-17-2007
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 <(E-Mail Removed)> 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



 
Reply With Quote
 
 
 
 
marss
Guest
Posts: n/a
 
      09-17-2007

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

 
Reply With Quote
 
Danielle
Guest
Posts: n/a
 
      09-17-2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to retrieve form field value if form is EncType=multipart/form-dataForm? Li Zhang ASP .Net 4 02-27-2009 01:23 AM
How to retrieve raw HTTP Post Data manheim@gmail.com ASP .Net 5 11-15-2007 11:40 PM
Request.Form to retrieve looped form fields David ASP General 2 09-20-2007 01:33 PM
how can i retrieve the name of form when one of the element name in this form is 'name' ashok.dhananjeyan@gmail.com Javascript 6 11-24-2006 02:54 AM
Can post form data in IIS, but doesnt post it via webserver J. Muenchbourg Javascript 0 08-06-2003 05:23 PM



Advertisments