Retrieve POST data from an HTML Form in asp.net

D

Danielle

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
 
N

Nick Chan

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")
 
M

marss

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
 
D

Danielle

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top