Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Real-World Web Development with .NET 10

You're reading from   Real-World Web Development with .NET 10 Build websites and services using mature and proven ASP.NET Core MVC, Web API, and Umbraco CMS

Arrow left icon
Product type Paperback
Published in Dec 2025
Publisher Packt
ISBN-13 9781835888926
Length 744 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Mark  J. Price Mark J. Price
Author Profile Icon Mark J. Price
Mark J. Price
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Introducing Real-World Web Development Using .NET 2. Building Websites Using ASP.NET Core MVC FREE CHAPTER 3. Model Binding, Validation, and Data Using EF Core 4. Building and Localizing Web User Interfaces 5. Authentication and Authorization 6. Performance and Scalability Optimization Using Caching 7. Web User Interface Testing Using Playwright 8. Configuring and Containerizing ASP.NET Core Projects 9. Building Web Services Using ASP.NET Core Web API 10. Building Clients for Web Services 11. Testing and Debugging Web Services 12. Building Web Services Using ASP.NET Core OData 13. Building Web Services Using FastEndpoints 14. Web Content Management Using Umbraco CMS 15. Customizing and Extending Umbraco CMS 16. Epilogue 17. Unlock Your Exclusive Benefits 18. Index

Understanding web development

Developing for the web means developing with the Hypertext Transfer Protocol (HTTP), so we will start by reviewing this important foundational technology.

Understanding the Hypertext Transfer Protocol

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

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.

Understanding the components of a URL

A URL is made up of several components:

  • Scheme: http (clear text) or https (encrypted).
  • Domain: For a production website or service, the Top-Level Domain (TLD) might be example.com. You might have subdomains such as www, jobs, or extranet. During development, you typically use localhost for all websites and services.
  • Port number: For a production website or service, use 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.
  • Path: A relative path to a resource, for example, /customers/germany.
  • Query string: A way to pass parameter values, for example, ?country=Germany&searchtext=shoes.
  • Fragment: A reference to an element on a web page using its 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).

Using Google Chrome to make HTTP requests

Let’s explore how to use Google Chrome to make HTTP requests:

  1. Start Google Chrome.
  2. Navigate to More tools | Developer tools.
  3. Click the Network tab, and Chrome should immediately start recording the network traffic between your browser and any web servers (note the red circle), as shown in Figure 1.19:
Figure 1.19: Chrome Developer tools recording network traffic

Figure 1.19: Chrome Developer tools recording network traffic

  1. In Chrome’s address box, enter the address of Microsoft’s website for learning ASP.NET, which is the following URL: https://dotnet.microsoft.com/en-us/learn/aspnet.
  2. In Developer Tools, in the list of recorded requests, scroll to the top and click on the first entry, the row where Type is document, as shown in Figure 1.20:
Figure 1.20: Recorded requests in Developer Tools

Figure 1.20: Recorded requests in Developer Tools

  1. On the right-hand side, click on the Headers tab, and you will see details about Request Headers and Response Headers, as shown in Figure 1.21:
Figure 1.21: Request and response headers

Figure 1.21: Request and response headers

Note the following aspects:

  • Request Method is GET. Other HTTP methods that you could see here include POST, PUT, DELETE, HEAD, and PATCH.
  • Status Code is 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.
  • Request Headers sent by the browser to the web server include:
    • 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.
  • Response Headers (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.)
  1. Close Chrome.

Understanding client-side web development technologies

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:

  • HTML5: This is used for the content and structure of a web page.
  • CSS3: This is used for the styles applied to elements on the web page.
  • JavaScript: This is used to code any business logic needed on the web page, for example, validating form input or making calls to a web service to fetch more data needed by the web page.

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:

  • Bootstrap, the world’s most popular frontend open-source toolkit
  • SASS and LESS, CSS preprocessors for styling
  • Microsoft’s TypeScript language for writing more robust code
  • JavaScript libraries such as Angular, jQuery, React, and Vue

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:

  • Node.js, a framework for server-side development using JavaScript
  • Node Package Manager (npm) and Yarn, both client-side package managers
  • webpack, a popular module bundler and a tool for compiling, transforming, and bundling website source files
lock icon The rest of the chapter is locked
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Real-World Web Development with .NET 10
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime
Modal Close icon
Modal Close icon