ASPX receiving a POST from an HTML

You have an HTML file that you want it to post to an ASPX file. What do you do?

1. Simple, make sure that the name attribute is used on the HTML file’s tags.

2. On the HTML file’s form tag the “action” attribute must point to your ASPX file that you want to process the request.

3. Make sure that the “method” attribute is set to post.
3a. If the “method” attribute is set to “get” then the form will send the results in the URL, resulting in the QueryString collection.

You are basicly done.

The form that the HTML page is pointing to will get the results, and store the values in the Request.Form property under the HTML element’s name attribute.
So using the sample from above, Request.Form[“DoesNotHaveToBeTheSameNameAsTheID”] would hold the value entered into the textbox.

Do I even need the “id” attribute then? If you believe in well formed pages, yes! “id” is a required attribute for xhtml.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.