473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Can someone give me a good reference HowTo write out a proper HttpPOST method?

Hello,

I was wondering if anyone could refer me to a good website that details what exactly makes up the GET and POST methods of a HttpRequest/Response class?

Basically, I am trying to figure out how do you POST data to a website. Many examples seem to be using the URL bar for POSTing, like submitting a search to Google for example is something like "Searchstringhere"&button=click if I'm not mistaken. But if I'm not wrong the POST method just sends a string out to google like this ("http://www.google.com/"SearchStringHere"*button=click"). None of this makes sense to me as I thought everything travels as a packet. What if you were trying to enter text into a message board? You wouldn't put the whole message board text string into a POST string, would you? Even if that was the case, how would you go about posting it? I thought (almost every) website was javascripted, does a POST method handle that?

Basically I don't see the whole picture of whats going on, and not even MSDN is sheding any light on how HttpRequest/HttpResponse actually sends out data with a POST method. If anyone can reference me to a website or a forum response that explains in detail just how C# can send and recieve information with HttpRequest and HttpResponse, it would be very helpful. Thank you!
Nov 12 '08 #1
5 1685
Frinavale
9,735 Expert Mod 8TB
Hi there!
You have a lot of questions!
Most of these are answered during courses you take at school for web development.

Basically, I am trying to figure out how do you POST data to a website...

But if I'm not wrong the POST method just sends a string out to google like this ("http://www.google.com/"SearchStringHere"*button=click"). Even if that was the case, how would you go about posting it?
HTTP is a request/response standard between a client (the web browser) and a server. POST is a way your data submitted to the server to be processed. This is outlined in the HTTP protocol. You should research HTTP before attempting to do any web development.

]
You wouldn't put the whole message board text string into a POST string, would you?
Simply put: Yes.

The data that's submitted to the server is anything between <form> tags in the body of the HTML. Not all of the data is submitted to the server. Just the stuff that's important (the Input).

]
None of this makes sense to me as I thought everything travels as a packet.
Typically the TCP/IP protocol is used when submitting data to the server. You should research this protocol to understand how the data is transferred to the server.


]
I thought (almost every) website was javascripted, does a POST method handle that?
JavaScript is a client side scripting language that lets you preform some functionality in the web browser. It can be used to validate data before sending it to the server, but has nothing to do with the POST method.


Basically I don't see the whole picture of whats going on, and not even MSDN is sheding any light on how HttpRequest/HttpResponse actually sends out data with a POST method. If anyone can reference me to a website or a forum response that explains in detail just how C# can send and recieve information with HttpRequest and HttpResponse, it would be very helpful. Thank you!
I strongly recommend taking a course on web development before tackling these questions.

-Frinny
Nov 12 '08 #2
Plater
7,872 Expert 4TB
To help you with your search, you are using a big munged definition of POST. "POST"ed data does not go in the URL, that is the query string.
Generally you will have one or the other. On a <form> tag you can POST or GET, GET is the way a normal webpage request works, like clicking a link or entering a URL in the bar manually. The values are all contained in the header section of an HTTP request.
POST sends data as "content", after the HTTP header.
If you are really curious, I would suggest following frinny's advice and looking up the RFCs for HTTP
Nov 12 '08 #3
Wow! Thanks! This really helped clear up some of the confusion. I've been looking into HttpRequest/HttpResponse code samples but it was hard to tell what exactly was going on, and I couldn't find good detailed explanations of the big picture, so, thanks again!

I'd just like to ask (or note) that I've been using Fiddler2, and while I can see (If i'm looking at it correctly) what makes up a Http Get response, I can't for the life of me find any Post responses. Do you guys know if Fiddler supports POSTs, or if there is a better web monitoring program I should be using?

If not, no big deal, I'm quite happy with the resources and ideas I was pointed too, thanks again!
Nov 12 '08 #4
Plater
7,872 Expert 4TB
Fiddler is just a packet watcher right?
You should be able to follow the TCP/IP stream and recreate a request.

Here is an example I pulled from ethereal (modified to hide private-ish data)

POST Request
Expand|Select|Wrap|Line Numbers
  1. POST /customer/customer.cgi?saveSMTPSettings&time=1226585314297 HTTP/1.1
  2. Accept: */*
  3. Accept-Language: en-us
  4. Content-Type: application/x-www-form-urlencoded
  5. Accept-Encoding: gzip, deflate
  6. User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 3.0.04506.30; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
  7. Host: MyHost
  8. Content-Length: 137
  9. Connection: Keep-Alive
  10. Cache-Control: no-cache
  11.  
  12. DisplayName=MyHost&EmailAddress=email@domain.com&Server=mail.domain.com&Port=25&Username=username@domain.com&Password=pass&UseAuth=true
  13.  
  14.  
  15.  

Server Response
Expand|Select|Wrap|Line Numbers
  1. HTTP/1.0 200 OK
  2. Content-Length: 23
  3. RESPONSE|STATUS=SUCCESS
  4.  
Nov 13 '08 #5
YOU are the man!

Thanks again!
Nov 14 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: David Dorward | last post by:
I'm attempting to read an XHTML 1.1 file, perform some DOM manipulation, then write the results to a different file. I've found myself rather stuck at the first hurdle. I have the following: ...
2
by: Junkmail | last post by:
I've been playing with Zope for about a year and took the plunge last week into making a product. To keep it simple I used a ZClass to wrap an external method. My ZClass works and returns the...
3
by: Marc Walgren | last post by:
Greetings I have an ASP application to enter reservations. There are multiple user security settings that require some users to have a restricted list of client in a drop list on a form. I...
6
by: Helmut Giese | last post by:
Hello out there, I am a rather experienced C programmer. However, today I got a javascript assignment because someone left (something like: "You're a great programmer - you'll handle this.") and I...
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
14
by: Robin Tucker | last post by:
Although I've been working on this project for 8 months now, I'm still not sure of the difference between ByVal and ByRef. As most objects in VB are reference types, passing ByVal I've discovered...
0
by: Edmund Green | last post by:
Included below is a minimal web-service implementation to recreate a problem I've encountered in a web service that has methods returning classes with the same local name (but in different...
0
by: Matthew Lock | last post by:
Hello, I am enabling my web service via HttpPost so that a simple Javascript client can access web services by posting with XmlHttpRequest. I have added the following nodes into my web.config to...
5
by: Dave | last post by:
I'm writing an app that needs to send info to a client by their specs, m_request= "https://website.com/app?xml=xml_file&xmlString=<?xml version='1.0' encoding='utf-8'...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.