asp.net.ph

HtmlForm.Method Property

System.Web.UI.HtmlControls Namespace   HtmlForm Class


Sets or retrieves a value that indicates how a browser posts form data to the server for processing.

Syntax


Inline <form method = "GET" | "POST" ... >
Script HtmlForm.Method [ = "GET" | "POST" ]

Property Value


GET Sends the form data as arguments appended to the request URI.
POST Sends the form data as an HTTP post transaction in the request message.

The property is read/write with a default value of POST.

Remarks

This property specifies the HTTP method used to send the form to the processing agent. The propety accepts only either of two values: GET or POST.

With the GET method, the form data set is appended to the URI specified by the action attribute ( with a question mark [ ? ] as separator ) and this new URI is sent to the processing agent.

With the POST method, the form data set is included in the body of the request message when the form is sent to the processing agent.

GET is typically used when the submitted form data does not matter even if seen, as in search forms, which make ideal applications for the method.

The POST method is generally used when the submitted data will effect changes to the destination, such as if the form data set modifies a database.

Notes on the GET Method

The GET method has been deprecated due to security considerations, as the form data is visible in the document location. The method is useful, though, for debugging transactions because the submission string is seen as a part of the destination path.

The GET method restricts form data set values to ASCII characters, and limits the amount of data to 256 characters.

Notes on the POST Method

POST can be specified with the enctype="multipart/form-data" attribute to cover the entire ISO-10646 character set, which is useful when attaching files with the form data set, or in data using extended characters.

POST is not limited in size, and is the preferred method for transmitting data that must be secure.

If the service associated with the processing of a form causes side effects, for example, if the form modifies a database or subscription to a service, the POST method should be used.

See Also

HtmlForm Members   EncType Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph