In Page_Load, use Request directly to allow GET and POST of data from client.
Request.QueryString[] will return value from the GET request of query string.
i.e., http://[url]?data=somedata
Request.QueryString["data"] //will return "somedata"
Request.Form[] will return value of POST request.
i.e.,
<form action="http://[url]/Default.aspx" method="post">
<input name="data" type="text" value="somedata" id="data" />
<input type="submit" name="Button1" value="Button" id="Button1" />
</form>
Request.Form["data"] //will return "somedata"
Request[] will look through all the collections below to find a match:
HttpRequest.QueryString
HttpRequest.Form
HttpRequest.Cookies
HttpRequest.ServerVariables
i.e., if Request["data"] is used, the page will accept GET and POST request without specifying which specific method the page will allow.
No comments:
Post a Comment