difference between http get and post

what are difference between http post and get, as far as what/how data is passed in a http request.
Reason I'm asking is, I created a simple ASP.NET MVC application. I have two methods (shown below, example contrived for this question). one method is decorated with [HttpPost] and other one is not. when i make a call from a third party app, it hits the break point in the first function ProcessData1 and I get the id parameter as well, since it is being passed in query string.
but if i try to make a call to ProcessData2, it doesn't hit the break point in that function.
I know the third party application, I'm using is making a Http post call.
I tried another rest client and this time when I made a call to ProcessData2, it was successful.

can some one point out possible reasons?

        public ActionResult ProcessData1(string id) {          
            return View(request);
        }

       [HttpPost]
        public ActionResult ProcessData2() {          
            return View(request);
        }
mikha eAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun VermaakTechnical SpecialistCommented:
Do you get the same with SoapUI?
https://www.soapui.org/
0
nociSoftware EngineerCommented:
an HTTP GET is a request for data , the request is on the first line in the packet after GET  (<protocol:>//[user[:password]@][host][:port]/URI
it starts with the /.
the protocol part is parsed away (the method is used to make the connection)
the user:password are optional and if provided they are placed in the header on a later line.
The hostname is provided in the header on a later line and a translation is used to connect to the host on the port mentioned or the default for the protocol. Anything after that in on the line.
The content part of the GET query is empty.
In the answer the content of the HTTP packet contains the data the host wanted to send.  In classical sense the contents of the requested file.

The real opposite of the GET is a PUT (put a file on the server...)    but that is not often used.
Instead a POST is used. The result is that data is sent to the host with the URI on the first line (like in the GET).
The contents of the packet contains all data (tail after the header).
The server will run a script as response to a POST, and will either hand over the content part as is, or even split it in "fields" and feed the named fields to the script that is run.
if you want to experiment with it the cURL tool is very handy (from: haxx.se)
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mikha eAuthor Commented:
thanks @noci - for the explanation. I also read today that "in get request, the data is sent in the query string and in post it is sent in the form values".

so i guess, when the request hits the server method, the get request is in format below

http://localhost/somemethod?id=4&name=demo. I am using ASP.NET to learn concepts of this, I have a controller method as below. so when tested, the id and name value in the query string are mapped to corresponding parameters in my controller method.
this is where the model binding comes in, I think right?
so based on this , how would one read or get data for the HTTP post call?

public somemethod(string id, string name){
}
0
nociSoftware EngineerCommented:
yes you are correct.
In most cases both ways of delivering are processed by standard libraries, which will parse the data in name/value pairs and pass those to the programs.
.NET is not my cup of tea, but PHP provide name value pairs . Perl has a library to convert the CGI parameters into name/value pairs. etc.
Both PHP and Perl + Library can handle both forms on input and will provide name value pairs.
(even for posted files (ie. File upload)...).  (in that case it is just a BIG field..)
0
mikha eAuthor Commented:
@noci - thanks for your explanation. I'm going to post another question under asp.net mvc.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.