Requesting a Web page.
-
Hi How can I request a web page using POST while passing some variables? Like I want to access http://www.localhost.com/info.aspx with POST and with variables info=0 and set=1 ? thanks in advance; mE --------------------- A gasp of breath, A sudden death: The tale begun. A rustled page Passes an age: The tale is done.
-
Hi How can I request a web page using POST while passing some variables? Like I want to access http://www.localhost.com/info.aspx with POST and with variables info=0 and set=1 ? thanks in advance; mE --------------------- A gasp of breath, A sudden death: The tale begun. A rustled page Passes an age: The tale is done.
The easy way is with the
System.Net.WebClient
class, which has anOpenWrite
method that you can pass a URL and "POST" (as the second param). Then you just write your &-delimited name/values pairs to the stream. This is just a wrapper for doing the same thing - in concept - using theWebRequest
andWebResponse
classes. All these things have good examples to show you (especially theWebClient.OpenWrite
method overload list page).-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----