We help IT Professionals succeed at work.

HttpWebRequest with GET and POST

mfalconmtz asked
Last Modified: 2010-07-27
I want to send data to a url via HttpWebRequest in ASP.net but I need to send some data via GET method and another data via POST method, is it possible? How do I send it?
Watch Question

Are you saying that you want to send both GET and POST data in the same request. I think that's possible. You can encode the GET data as Query String, but still set the request method as POST and write the POST data into the request stream.


If I use:

req = CType(WebRequest.Create("http://mydomain/Link.aspx?opt=0949889EA5EA&type=simple&pass=False"), HttpWebRequest)

I send opt, type and pass via GET?
Well, to be correct, actually you are sending those through query string. However, if you are making GET request, the only way you can pass parameters is also through query string.
Btw, what do you want to achieve actually? Maybe if you can tell use more, we can provide better suggestion ...
This one is on us!
(Get your first solution completely free - no credit card required)


I want to suscribe e-mail addresses to a mailing list via code, the form to suscribe to this list send query string parameters and the name and e-mail address with a POST like this.

<form method="POST" action="http://mydomain/Link.aspx?opt=0949889EA5EA&type=simple&pass=False">
<input type="text" name="name">
<input type="text" name="email">

Open in new window

This one is on us!
(Get your first solution completely free - no credit card required)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.