Reading HTML form post in ASP.Net

  • Thread starter Sergey Poberezovskiy
  • Start date
S

Sergey Poberezovskiy

Hi,

I am trying to read form values from HTML form in ASP.Net.
For example:

first.html file
<html><body><form action="second.aspx" method="post">
<input type=text id="txtOne" />
<input type=submit value=OK />
</form></body></html>

second.aspx file code (I use VB):
Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
Console.Write(Me.Request.Form("txtOne"))
End Sub

The Form collection of the page.Request is EMPTY!!!

Could someone please help?

Any suggestions/directions are very much appreciated.
 
M

Martin Honnen

Sergey Poberezovskiy wrote:

I am trying to read form values from HTML form in ASP.Net.
For example:

first.html file
<html><body><form action="second.aspx" method="post">
<input type=text id="txtOne" />

An input element needs a name attribute to be submitted:
<input type="text" name="txtOne">
 
Joined
Jun 11, 2009
Messages
1
Reaction score
0
Losing my mind over this terribly simple thing

I have tried everything in your thread but it does not work. TO back up, I am using Visual studio 2005. An html file with a form post action set to a .net file that should display the results... but does not. Any help appreciated.

HTML FILE
<html>
<body>
<form action="DataCollection.aspx" method="post">
<input id="text1" type="text" name="text1" />
<input id="text2" type="text" name="text2" />
<input id="Submit1" type="submit" value="submit" />
</form>
</body>
</html>

.net File (vb)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ret As String = ""
If Not IsPostBack Then
Response.Write(Request.Form("text1"))
Response.Write(Request.Form("text2"))
End If
End Sub

This always writes out as empty - no values passed! I fear this is something incredibly stupid that i will be embarrassed by.
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top