-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Real-World Web Development with .NET 10 - Second Edition
By :
Developing for the web means developing with the Hypertext Transfer Protocol (HTTP), so we will start by reviewing this important foundational technology.
To communicate with a web server, the client, also known as the user agent, makes calls over the network using HTTP. As such, HTTP is the technical underpinning of the web. So when we talk about websites and web services, we mean that they use HTTP to communicate between a client (often a web browser) and a server.
A client makes an HTTP request to a resource, such as a page, uniquely identified by a URL, and the server sends back an HTTP response, as shown in Figure 1.18:

Figure 1.18: An HTTP request and response
You can use Google Chrome and other browsers to record requests and responses.
Good practice: Google Chrome is currently used by about two-thirds of website visitors worldwide, and it has powerful, built-in developer tools, so it is a good first choice for trying out your websites. Try out your websites with Chrome and at least two other browsers, for example, Firefox and Safari for macOS and iPhone, respectively. Microsoft Edge switched from using Microsoft’s own rendering engine to using Chromium in 2019, so it is less important to try out with it, although some say Edge has the best developer tools. If Microsoft’s Internet Explorer is used at all, it tends to be mostly inside organizations for intranets.
A URL is made up of several components:
http (clear text) or https (encrypted).example.com. You might have subdomains such as www, jobs, or extranet. During development, you typically use localhost for all websites and services.80 for http and 443 for https. These port numbers are usually inferred from the scheme. During development, other port numbers are commonly used, such as 5000, 5001, and so on, to differentiate between websites and services that all use the shared domain localhost./customers/germany.?country=Germany&searchtext=shoes.id value, for example, #toc.A URL is a subset of a Uniform Resource Identifier (URI). A URL specifies where a resource is located and how to get it. A URI identifies a resource either by the URL or Uniform Resource Name (URN).
Let’s explore how to use Google Chrome to make HTTP requests:

Figure 1.19: Chrome Developer tools recording network traffic
https://dotnet.microsoft.com/en-us/learn/aspnet.
Figure 1.20: Recorded requests in Developer Tools

Figure 1.21: Request and response headers
Note the following aspects:
GET. Other HTTP methods that you could see here include POST, PUT, DELETE, HEAD, and PATCH.200 OK. This means that the server found the resource that the browser requested and has returned it in the body of the response. Other status codes that you might see in response to a GET request include 301 Moved Permanently, 400 Bad Request, 401 Unauthorized, and 404 Not Found.accept, which lists what formats the browser accepts. In this case, the browser is saying it understands HTML, XHTML, XML, and some image formats, but it will accept all other files (*/*). Default weightings, also known as quality values, are 1.0. XML is specified with a quality value of 0.9, so it is less preferable than HTML or XHTML. All other file types are given a quality value of 0.8, so they are the least preferred.accept-encoding, which lists what compression algorithms the browser understands, in this case, GZIP, DEFLATE, and Brotli.accept-language, which lists the human languages it would prefer the content to use, in this case, US English, which has a default quality value of 1.0; any dialect of English, which has an explicitly specified quality value of 0.9; and then any dialect of Swedish, which has an explicitly specified quality value of 0.8.content-encoding), which tells me that the server has sent back the HTML web page response compressed using the gzip algorithm, as it knows that the client can decompress that format. (This is not visible in Figure 12.9 because there is not enough space to expand the Response Headers section.)When building websites, a developer needs to know more than just C# and .NET. On the client (that is, in the web browser), you will use a combination of the following technologies:
Although HTML5, CSS3, and JavaScript are the fundamental components of frontend web development, there are many additional technologies that can make frontend web development more productive, including:
All these higher-level technologies ultimately translate or compile to the underlying three core technologies, so they work across all modern browsers.
As part of the build and deploy process, you will likely use technologies such as: