Web applications consist of several components: servers, browsers, and communication protocols. You can decide different technologies and products for servers and browsers. But you need to use HTTP as a basic communication protocol.
ASP.NET is a server technology. Most works are done in a server and the result HTML will send to a client’s browser. ASP.NET server controls do their best to show the result similar across all browsers.
This post is not specific to ASP.NET. All web programming models share the common components.
1. Web Servers
The web server is responsible for accepting requests for a resource and sending the appropriate response.
- Stateless: process GET request, send response, and close server connection
- State: process GET request, execute server-side code, store session data, and send response
2. Web Browsers
The web browser is responsible for displaying data to a user, collecting data from a user, and sending data to the web server.
HTTP (Hypertext Transfer Protocol) is a text-based communication protocol that is used to communicate between web browsers and web servers using port 80. “Secure HTTP (HTTPS)” uses port 443.
Each HTTP command contains a method (also called a verb) that indicates the desired action.
- GET: used to obtain a web resource, usually in a read only fashion
- POST: used to send data to a web server
- HEAD: equivalent to GET except that it only returns meta-information of the resource
- OPTIONS: lists which of the seven methods can be executed against a target resource
- TRACE: is for debugging purposes and reflects a client request back from the server to the client to check how it might have changed en route
- PUT: places a resource at the URL that is the target of the HTTP request
- DELETE: removes the resource from the URL
HTTP methods can be grouped:
- Safe methods: GET, OPTIONS, HEAD, and TRACE
- Unsafe methods: PUT, DELETE, and POST
The idempotent method means that if you execute them more than once, the result is the same as executing them only once. POST is the only one that is NOT considered “idempotent.”
Distributed Authoring and Versioning (DAV) is a set of extensions to HTTP/1.1 that simplifies Web development when working in a team scenario.
- DAV provides more methods such as LOCK/UNLOCK files
- DAV directly built on HTTP, so no other protocols required
5. HTTP Status Code
- 1xx: Informational
- 2xx: Success
- 3xx: Redirect
- 4xx: Client Error
- 5xx: Server Error
(examples) 100: Continue 200: OK 201: Created 300: Multiple Choices 301: Moved Permanently 400: Bad Request 401: Unauthorized 403: Forbidden 404: Not Foundbr 407: Proxy Authentication Required 408: Request Time-out 500: Internal Server Error 501: Not Implemented
Sending data back to the same page in the server from the browser is referred to as a Postback. It is the basic method to send data to a server in ASP.NET.
<form id="form1" runat="server"> Enter Customer ID: <input type=”text” id=”Id” runat="server" /> <input type=”submit” runat="server" value=”Get Customer” /> </form>