Showing posts with label protocols. Show all posts
Showing posts with label protocols. Show all posts

HTTP GET AND HTTP POST


HTTP GET :

Let's say you have a page and want the user to click a link to view the first article in this series.
In this case a simple hyperlink is all you need.

<a href="http://coding-issues.com/Articles/741.aspx">Part I</a>

When a user clicks on the hyperlink in a browser, the browser issues a GET request to the URL
specified in the href attribute of the anchor tag. The request would look like this:

GET http://odetocode.com/Articles/741.aspx HTTP/1.1
Host: odetocode.com


HTTP POST :

Now imagine you have a page where the user has to fill out information to create an account. Filling out information requires <input> tags, and we nest these inputs inside a <form> tag and tell the browser where to submit the information.

<form action="/http/www.coding-issues.in/account/create" method="POST">
<label for="firstName">First name</label>
<input id="firstName" name="firstName" type="text" />
<label for="lastName">Last name</label>
<input id="lastName" name="lastName" type="text" />
<input type="submit" value="Sign up!"/>
</form>

When the user clicks the submit button, the browser realizes the button is inside a form. The form tells the browser that the HTTP method to use is POST, and the path to POST is /account/create. The actual HTTP request the browser makes will look something like this. 

POST http://localhost:1060/account/create HTTP/1.1
Host: server.com
firstName=Scott&lastName=Allen
Notice the form inputs are included in the HTTP message.

Read more...

What is Fragment in URL


The part after the # sign is known as the fragment. The fragment is different than the other pieces we've looked at so far, because unlike the URL path and query string, the fragment is not processed by the server. The fragment is only used on the client and it identifies a particular section of a resource. Specifically, the fragment is typically used to identify a specific HTML element in a page by the element's ID.

Web browsers will typically align the initial display of a webpage such that the top of the element identified by the fragment is at the top of the screen. As an example, the URL http://www.coding-issues.blogspot.com/Asp.Net#feedback has the fragment value "feedback". If you follow the URL, your web browser should scroll down the page to show the feedback section of a particular blog post on my blog. 

Your browser retrieved the entire resource (the blog post), but focused your attention to a specific area—the feedback section. You can imagine the HTML for the blog post looking like the following (with all the text content omitted):

<div id="post">
...
</div>

<div id="feedback">
...
</div>

The client makes sure the element with the “feedback” ID is at the top.

Read more...