Beginner 26 min read

How the Web Works

HTTP, DNS, browsers, servers, and client-server model.

How Does the Web Work?

Category: Getting Started
Difficulty: Beginner
Next Topic: Installing the .NET 10 SDK


Introduction

What Is the Web?

The World Wide Web is a system that allows computers and applications to communicate and exchange resources over the internet.

Those resources can include:

  • HTML pages
  • CSS
  • JavaScript
  • Images
  • Videos
  • JSON data
  • Files
  • API responses

When you open a website, your browser is acting as a client. It communicates with a server that hosts the requested application or resource.

For example:

Browser
   |
   | HTTP Request
   v
Web Server
   |
   | HTTP Response
   v
Browser

This basic request-response model is the foundation of most web applications.

Why Does the Web Exist?

Before the web, computers could communicate over networks, but sharing information in a simple, standardized way was difficult.

The web introduced common technologies such as:

  • URLs
  • HTTP
  • HTML
  • Web browsers
  • Web servers

Together, these technologies made it possible to access information from almost anywhere.

Why Should Developers Learn This?

As a .NET developer, you will frequently work with:

  • ASP.NET Core
  • REST APIs
  • HTTP requests
  • HTTP responses
  • Authentication
  • Web browsers
  • Reverse proxies
  • Load balancers
  • Cloud services
  • Microservices

If you understand what happens underneath ASP.NET Core, concepts such as middleware, controllers, APIs, authentication, and deployment become much easier to understand.

Interview Tip:
Don't memorize HTTP concepts independently. Understand the complete journey: URL → DNS → connection → HTTP request → server → HTTP response → browser.

What Problems Does the Web Solve?

The web makes it possible to:

  • Publish information
  • Build online stores
  • Process payments
  • Build banking systems
  • Expose APIs
  • Build SaaS applications
  • Connect mobile applications to servers
  • Communicate between distributed services

3. Real-Life Analogy

The Web as a Restaurant

Imagine going to a restaurant.

RestaurantWeb
CustomerBrowser
MenuWebsite/API documentation
OrderHTTP Request
KitchenServer/Application
ChefApplication code
Prepared foodHTTP Response
Table numberAddress/URL
WaiterNetwork communication

Suppose you ask for a pizza.

Customer
   |
   | "I want a pizza"
   v
Waiter
   |
   v
Kitchen
   |
   | Prepare pizza
   v
Waiter
   |
   v
Customer

The web works similarly:

Browser
   |
   | HTTP Request
   v
Server
   |
   | Process request
   v
Application
   |
   | HTTP Response
   v
Browser

The important concept is:

The browser doesn't directly execute your server-side C# code. It sends a request to the server, and the server sends back a response.


4. Architecture Diagram

Simplified Architecture

                    Internet
                       |
                       v
              +----------------+
              |  DNS Resolution |
              +----------------+
                       |
                       v
              +----------------+
              |  Server / Cloud |
              +----------------+
                       |
                       v
              +----------------+
              | ASP.NET Core   |
              | Application    |
              +----------------+
                       |
                       v
              +----------------+
              |    Database    |
              +----------------+

5. Concept Explanation

5.1 Client

A client is a device or application that requests something from a server.

Examples:

  • Chrome
  • Edge
  • Firefox
  • Mobile applications
  • Desktop applications
  • Another backend service

For example:

Browser → Request → Server

5.2 Server

A server is a computer or application that receives requests and provides resources or services.

A server might:

  • Return a webpage
  • Execute business logic
  • Query a database
  • Authenticate a user
  • Process an order
  • Return JSON from an API

For an ASP.NET Core application:

HTTP Request
     ↓
ASP.NET Core
     ↓
Business Logic
     ↓
Database
     ↓
HTTP Response

5.3 Internet vs Web

These terms are related but not identical.

Internet is the global network infrastructure connecting computers.

Web is one service that runs over the internet.

Other services include:

  • Email
  • DNS
  • SSH
  • FTP
  • Web services

Think of the internet as the road network and the web as one type of vehicle using those roads.


5.4 What Is a URL?

A URL tells the client where a resource is located.

Example:

https://example.com/products/10?currency=INR

Break it down:

https://
   ↓
Protocol

example.com
   ↓
Domain

/products/10
   ↓
Path

?currency=INR
   ↓
Query String

URL Components

ComponentExamplePurpose
SchemehttpsCommunication protocol
Hostexample.comServer/domain
Port443Network endpoint
Path/products/10Resource/path
Query?page=2Additional parameters
Fragment#reviewsClient-side page location

5.5 What Is HTTP?

HTTP stands for HyperText Transfer Protocol.

It defines how clients and servers communicate.

A simplified HTTP conversation looks like:

Client:
GET /products/10 HTTP/1.1

Server:
HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": 10,
    "name": "Laptop"
}

HTTP defines:

  • Request methods
  • Headers
  • Status codes
  • Request body
  • Response body

5.6 What Is HTTPS?

HTTPS means:

HTTP Secure

HTTPS uses TLS to protect communication between the client and server.

Without encryption:

Browser -------- readable data --------> Server

With HTTPS:

Browser ---- encrypted communication ----> Server

HTTPS helps protect:

  • Passwords
  • Authentication tokens
  • Personal information
  • Payment information
  • API data

Best Practice:
Production applications should use HTTPS.


5.7 HTTP Request

A request is sent by the client to the server.

Example:

GET /products/10 HTTP/1.1
Host: example.com
Accept: application/json
Authorization: Bearer <token>

An HTTP request can contain:

  1. Method
  2. URL/path
  3. Headers
  4. Body

5.8 HTTP Response

The server sends a response back.

Example:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": 10,
    "name": "Laptop"
}

A response normally contains:

  • Status code
  • Headers
  • Response body

5.9 HTTP Methods

HTTP methods describe what the client wants to do.

MethodCommon Purpose
GETRetrieve data
POSTCreate/process data
PUTReplace/update a resource
PATCHPartially update a resource
DELETEDelete a resource
HEADRetrieve headers without response body
OPTIONSDiscover supported operations

Example:

GET /api/products

means:

Give me the products.

While:

POST /api/products

means:

Create a new product using the supplied data.


5.10 HTTP Status Codes

The server uses status codes to describe the result.

2xx — Success

200 OK
201 Created
204 No Content

3xx — Redirection

301 Moved Permanently
302 Found
304 Not Modified

4xx — Client Error

400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
409 Conflict
429 Too Many Requests

5xx — Server Error

500 Internal Server Error
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout

Important:
401 generally means the client is not authenticated.
403 generally means the client is authenticated but does not have permission.


5.11 What Is DNS?

DNS stands for:

Domain Name System

Humans prefer:

example.com

Computers communicate using IP addresses such as:

203.0.113.10

DNS translates a domain name into an IP address.

example.com
      |
      v
DNS
      |
      v
203.0.113.10

Think of DNS as the phone book of the internet.


5.12 What Is a Port?

A server can expose different services through different ports.

Common examples:

PortCommon Use
80HTTP
443HTTPS
22SSH
1433SQL Server

For local ASP.NET Core development, you might see:

https://localhost:7001

Here:

localhost = current computer
7001 = port

5.13 Browser and Server-Side Code

A browser can execute:

  • HTML
  • CSS
  • JavaScript

A server can execute:

  • C#
  • Java
  • JavaScript/Node.js
  • Java
  • Python
  • Go

For ASP.NET Core:

Browser
   |
   | HTTP Request
   v
ASP.NET Core
   |
   | Execute C#
   v
Database / Services
   |
   v
HTTP Response
   |
   v
Browser

Your C# code usually executes on the server, not inside the browser.


5.14 What Is an API?

An API allows software applications to communicate.

For example:

React Application
       |
       | GET /api/products
       v
ASP.NET Core API
       |
       v
SQL Server

The API may return:

[
  {
    "id": 1,
    "name": "Laptop"
  }
]

APIs are heavily used in:

  • Web applications
  • Mobile applications
  • Microservices
  • Third-party integrations
  • Internal enterprise systems

6. Important Terminology

TermMeaningExample
ClientApplication requesting a resourceBrowser
ServerSystem processing requestsASP.NET Core server
URLAddress of a resourcehttps://example.com/products
DNSConverts domain to IPexample.com → IP
HTTPWeb communication protocolGET request
HTTPSHTTP secured with TLShttps://...
RequestMessage sent by clientGET /products
ResponseMessage returned by server200 OK
APIInterface between software systems/api/orders
PortNetwork endpoint443
HeaderMetadata about request/responseContent-Type
Status CodeDescribes operation result404
JSONCommon data format{ "id": 1 }
CookieSmall browser-stored dataSession cookie
TLSSecurity protocol used by HTTPSTLS 1.3
ProxyIntermediate network componentCorporate proxy
Load BalancerDistributes requestsMultiple API servers

7. How It Works Internally

Suppose you enter:

https://example.com/products/10

What actually happens?

Step 1 — Browser Parses the URL

The browser identifies:

Protocol: HTTPS
Host: example.com
Path: /products/10

Step 2 — DNS Resolution

The browser needs the server's IP address.

example.com
     ↓
DNS
     ↓
IP address

DNS information may already be cached, avoiding a new lookup.

Step 3 — Establish Secure Connection

Because HTTPS is being used, the client establishes a secure TLS connection with the server.

Step 4 — Send HTTP Request

The browser sends something similar to:

GET /products/10 HTTP/1.1
Host: example.com
Accept: text/html

Step 5 — Server Receives Request

A web server or reverse proxy receives the request.

For example:

Internet
   ↓
Reverse Proxy
   ↓
ASP.NET Core

Step 6 — ASP.NET Core Processes the Request

ASP.NET Core runs the request through its pipeline.

A simplified pipeline:

Request
   ↓
Exception Handling
   ↓
HTTPS / Redirect
   ↓
Authentication
   ↓
Authorization
   ↓
Routing
   ↓
Endpoint
   ↓
Response

Step 7 — Application Executes

The application may:

  • Validate input
  • Query a database
  • Call another API
  • Execute business logic
  • Build a response

Step 8 — Server Sends Response

Example:

HTTP/1.1 200 OK
Content-Type: text/html

Step 9 — Browser Processes Response

The browser:

  • Parses HTML
  • Downloads CSS
  • Downloads JavaScript
  • Downloads images
  • Executes JavaScript
  • Builds the page

Complete Flow

Interview Shortcut:
Remember: DNS → Connection → Request → Server Processing → Response → Rendering


8. Syntax

HTTP Request Syntax

A simplified HTTP request looks like:

METHOD /path HTTP/version
Header-Name: value

Request Body

Example:

POST /api/products HTTP/1.1
Content-Type: application/json
Authorization: Bearer token

{
    "name": "Laptop",
    "price": 75000
}

Syntax Breakdown

PartMeaning
POSTHTTP method
/api/productsRequested resource
HTTP/1.1HTTP version
Content-TypeDescribes request data
AuthorizationAuthentication information
JSON bodyData sent to server

URL Syntax

scheme://host:port/path?query#fragment

Example:

https://example.com:443/products?page=2#reviews

9. Code Examples

9.1 Simple Example — Minimal ASP.NET Core API

Program.cs

var builder = WebApplication.CreateBuilder(args);

var app = builder.Build();

app.MapGet("/", () =>
{
    return "Hello from ASP.NET Core!";
});

app.Run();

The application exposes:

GET /

When the browser requests:

https://localhost:xxxx/

the server returns:

Hello from ASP.NET Core!

9.2 Intermediate Example — Product API

var builder = WebApplication.CreateBuilder(args);

var app = builder.Build();

var products = new List<Product>
{
    new(1, "Laptop", 75000),
    new(2, "Keyboard", 2500)
};

app.MapGet("/api/products", () =>
{
    return Results.Ok(products);
});

app.MapGet("/api/products/{id:int}", (int id) =>
{
    var product = products.FirstOrDefault(p => p.Id == id);

    return product is null
        ? Results.NotFound()
        : Results.Ok(product);
});

app.Run();

public record Product(int Id, string Name, decimal Price);

Requests

GET /api/products

returns all products.

GET /api/products/1

returns one product.

GET /api/products/999

returns:

404 Not Found

9.3 Production Example — Controller-Based API

For a larger application, separate responsibilities.

Controller

using Microsoft.AspNetCore.Mvc;

[ApiController]
[Route("api/[controller]")]
public class ProductsController : ControllerBase
{
    private readonly IProductService _productService;

    public ProductsController(IProductService productService)
    {
        _productService = productService;
    }

    [HttpGet]
    public async Task<ActionResult<IReadOnlyList<ProductDto>>> GetProducts(
        CancellationToken cancellationToken)
    {
        var products = await _productService.GetProductsAsync(
            cancellationToken);

        return Ok(products);
    }

    [HttpGet("{id:int}")]
    public async Task<ActionResult<ProductDto>> GetProduct(
        int id,
        CancellationToken cancellationToken)
    {
        var product = await _productService.GetProductAsync(
            id,
            cancellationToken);

        return product is null
            ? NotFound()
            : Ok(product);
    }
}

Service

public interface IProductService
{
    Task<IReadOnlyList<ProductDto>> GetProductsAsync(
        CancellationToken cancellationToken);

    Task<ProductDto?> GetProductAsync(
        int id,
        CancellationToken cancellationToken);
}

DTO

public sealed record ProductDto(
    int Id,
    string Name,
    decimal Price);

Why This Structure?

The controller handles HTTP concerns.

The service handles application/business logic.

HTTP
 ↓
Controller
 ↓
Service
 ↓
Repository / Database

This makes the application easier to:

  • Test
  • Maintain
  • Scale
  • Change

10. Folder Structure

A production ASP.NET Core application can be organized like:

ProductApi/
│
├── Controllers/
│   └── ProductsController.cs
│
├── Services/
│   ├── IProductService.cs
│   └── ProductService.cs
│
├── DTOs/
│   └── ProductDto.cs
│
├── Models/
│   └── Product.cs
│
├── Data/
│   ├── AppDbContext.cs
│   └── Configurations/
│
├── Middleware/
│   └── ExceptionHandlingMiddleware.cs
│
├── Program.cs
├── appsettings.json
└── appsettings.Production.json

Best Practice:
Do not put database queries, business rules, authentication logic, and HTTP handling into one controller.


11. Execution Flow

Consider:

app.MapGet("/api/products/{id:int}", (int id) =>
{
    return Results.Ok(new Product(id, "Laptop", 75000));
});

Line 1

app.MapGet(...)

Registers a GET endpoint.

Route

/api/products/{id:int}

means the endpoint expects an integer id.

For example:

/api/products/10

matches.

/api/products/abc

does not match because abc is not an integer.

Lambda Parameter

(int id)

ASP.NET Core obtains the route value and supplies it to the endpoint.

Response

Results.Ok(...)

creates a successful HTTP response.

The response status is:

200 OK

The object is serialized into JSON.


12. Real Project Usage

E-Commerce

Browser
   ↓
Product API
   ↓
Product Service
   ↓
Database

Used for:

  • Product search
  • Shopping carts
  • Orders
  • Payments
  • Inventory

Banking

Web communication supports:

  • Account information
  • Fund transfers
  • Transaction history
  • Authentication
  • Fraud detection

Security requirements are especially high.

Healthcare

Applications use web APIs for:

  • Patient records
  • Appointment systems
  • Lab results
  • Doctor portals

Sensitive data requires strong authorization and auditing.

Logistics

Web APIs support:

  • Shipment tracking
  • Driver applications
  • Warehouse systems
  • Delivery updates

Social Media

Web applications use APIs for:

  • Posts
  • Comments
  • Likes
  • Notifications
  • Messaging

Enterprise Software

Large organizations commonly use web applications for:

  • HR systems
  • CRM
  • ERP
  • Reporting
  • Internal portals
  • Workflow systems

13. Performance Considerations

Memory

Every request can consume memory through:

  • Request objects
  • Serialization
  • Large response objects
  • Database results
  • Temporary allocations

Avoid unnecessarily loading huge datasets.

Instead of:

Return 1,000,000 records

use:

Pagination

Example:

?page=1&pageSize=50

CPU

CPU is consumed by:

  • Serialization
  • Complex calculations
  • Encryption
  • Compression
  • Business logic

Avoid unnecessary CPU-intensive work inside request threads.

Scalability

A web application should ideally support increasing traffic.

             Load Balancer
              /    |    \
             /     |     \
          Server Server Server

Horizontal scaling means adding more application instances.

Optimization

Common optimization techniques:

  • Async I/O
  • Caching
  • Database indexing
  • Pagination
  • Compression
  • CDN
  • Connection pooling
  • Efficient serialization
  • Avoiding unnecessary database queries

Tip:
Optimize based on measurements. Don't guess where the bottleneck is.


14. Security Considerations

HTTPS

Always protect production traffic with HTTPS.

Authentication

Authentication answers:

Who are you?

Examples:

  • Cookies
  • JWT
  • OpenID Connect

Authorization

Authorization answers:

What are you allowed to do?

Example:

User → Read Orders
Admin → Read + Delete Orders

Common Vulnerabilities

SQL Injection

Never construct SQL using untrusted string concatenation.

Cross-Site Scripting

Never blindly render untrusted input as HTML.

Broken Authorization

Do not assume that hiding a button prevents unauthorized access.

The server must enforce permissions.

Sensitive Data Exposure

Do not expose:

  • Passwords
  • Secret keys
  • Internal tokens
  • Database credentials

CSRF

State-changing browser requests should be protected where applicable.

Excessive API Exposure

Do not expose internal fields simply because they exist in your database entity.

Use DTOs.

Security Rule:
Never trust data simply because it came from your own frontend. The server must validate and authorize every important operation.


15. Common Mistakes

#MistakeWhy It HappensFix
1Confusing internet and webTerms sound similarInternet is infrastructure; web is a service
2Thinking browser executes C#Server/client roles are unclearC# normally executes on the server
3Ignoring DNSBrowser makes it look invisibleUnderstand domain-to-IP resolution
4Using GET for everythingGET seems simpleUse methods according to intent
5Returning 200 for errorsStatus codes misunderstoodUse meaningful HTTP status codes
6Confusing 401 and 403Both relate to security401 = unauthenticated; 403 = forbidden
7Sending huge responsesPagination overlookedReturn only required data
8Trusting frontend validationUI validation feels sufficientValidate on server
9Hardcoding secretsLocal development habitUse secure configuration/secrets
10Putting everything in controllersQuick prototype growsSeparate API, business, and data concerns

16. Best Practices

  1. Use HTTPS in production.
  2. Use meaningful HTTP methods.
  3. Return appropriate HTTP status codes.
  4. Validate all external input.
  5. Apply authorization on the server.
  6. Use DTOs for API contracts.
  7. Keep controllers focused on HTTP concerns.
  8. Use asynchronous I/O for I/O-bound operations.
  9. Paginate large collections.
  10. Add database indexes based on query patterns.
  11. Avoid returning unnecessary data.
  12. Use structured logging.
  13. Never log passwords or access tokens.
  14. Store secrets outside source control.
  15. Use cancellation tokens for long-running operations.
  16. Use caching where repeated reads justify it.
  17. Configure production error handling without exposing stack traces.
  18. Use rate limiting for sensitive or public APIs.
  19. Monitor latency, errors, throughput, and resource usage.
  20. Test APIs independently from the frontend.
  21. Version public APIs when contract changes require it.
  22. Keep external API contracts backward compatible where practical.
  23. Use health checks for production services.
  24. Measure performance before optimizing.
  25. Keep network payloads small and predictable.

Production Mindset:
A web application is not just about making an HTTP request work. It must also be secure, observable, maintainable, scalable, and reliable.


17. Interview Questions

Beginner Questions

1. What is the web?

The web is a system for accessing and exchanging resources over the internet using technologies such as URLs, HTTP, HTML, browsers, and web servers.


2. What is a client?

A client is an application that requests a resource or service.

Example:

Chrome → Web Server

Chrome is the client.


3. What is a server?

A server is a system that receives requests and processes them to provide resources or services.

An ASP.NET Core application can act as a web server application.


4. What is HTTP?

HTTP is a protocol that defines how web clients and servers exchange requests and responses.


5. What is HTTPS?

HTTPS is HTTP protected using TLS encryption.

It helps protect data while it travels between client and server.


6. What is DNS?

DNS translates human-readable domain names into IP addresses.

example.com → IP address

7. What is a URL?

A URL identifies the location of a resource.

Example:

https://example.com/products/10

8. What is an HTTP request?

An HTTP request is a message sent by a client to a server asking it to perform an operation or return a resource.


9. What is an HTTP response?

An HTTP response is the server's message returned to the client.

It normally contains a status code, headers, and optionally a body.


10. What is an API?

An API is an interface that allows one software system to communicate with another.


Intermediate Questions

11. What happens when you type a URL into a browser?

A simplified flow is:

URL
 ↓
DNS
 ↓
IP address
 ↓
Connection
 ↓
HTTP request
 ↓
Server
 ↓
Application
 ↓
HTTP response
 ↓
Browser rendering

12. What is the difference between HTTP and HTTPS?

HTTP sends communication without TLS protection.

HTTPS uses TLS to provide encrypted communication and server identity verification.


13. What is the difference between GET and POST?

GET is normally used to retrieve resources.

POST is normally used to submit data or create/process a resource.


14. What is the difference between PUT and PATCH?

PUT is commonly used to replace the complete representation of a resource.

PATCH is commonly used for partial updates.


15. What is the difference between 401 and 403?

401 Unauthorized generally means the request lacks valid authentication credentials.

403 Forbidden means the server understands the request but refuses access.


16. Why is HTTP stateless?

Each HTTP request is generally independent.

The server does not automatically remember previous requests.

State can be maintained using mechanisms such as:

  • Cookies
  • Sessions
  • Tokens
  • Databases
  • Distributed caches

17. What are HTTP headers?

Headers provide metadata about a request or response.

Examples:

Content-Type: application/json
Authorization: Bearer token
Accept: application/json

18. What is JSON?

JSON is a lightweight text-based format commonly used to exchange structured data between applications.

Example:

{
  "id": 1,
  "name": "Laptop"
}

19. What is a reverse proxy?

A reverse proxy receives requests on behalf of backend services and forwards them to appropriate servers.

It can provide:

  • Routing
  • TLS termination
  • Load balancing
  • Security controls
  • Centralized access policies

20. Why do APIs use status codes?

Status codes give clients a standardized indication of the request result.

For example:

200 → Success
404 → Resource not found
500 → Server failure

Advanced Questions

21. What happens after DNS resolution?

The client establishes network communication with the resolved server address. For HTTPS, a TLS handshake establishes a secure connection before HTTP data is exchanged.


22. What is TLS?

TLS is a cryptographic protocol used to secure communication over networks.

HTTPS uses HTTP over TLS.


23. What is connection reuse?

Creating a network connection has overhead.

Modern HTTP clients can reuse connections rather than creating a new connection for every request, improving latency and resource usage.


24. What is HTTP/2?

HTTP/2 improves HTTP communication efficiency using features such as multiplexing, allowing multiple streams over a single connection.

It also uses binary framing and header compression.


25. What is HTTP/3?

HTTP/3 uses HTTP semantics over QUIC rather than traditional TCP transport.

QUIC runs over UDP and is designed to improve connection establishment and behavior in some network conditions.


26. What is a load balancer?

A load balancer distributes incoming requests across multiple backend instances.

              Load Balancer
              /     |     \
             v      v      v
           API-1  API-2  API-3

This improves scalability and availability.


27. Why are APIs usually stateless?

Stateless APIs are easier to scale horizontally because any healthy server can generally process the next request without depending on in-memory state from a previous request.

Shared state, when required, can be stored in databases, caches, or other distributed systems.


28. What is idempotency?

An operation is idempotent when repeating the same operation produces the same intended resource state.

For example, replacing a resource with the same representation using PUT is generally designed to be idempotent.

This concept is important for retrying network operations safely.


29. Why is caching important in web applications?

Caching avoids repeating expensive operations.

For example:

Without Cache:
Request → Database → Response

With Cache:
Request → Cache → Response

Caching can reduce:

  • Database load
  • Latency
  • CPU usage
  • Network traffic

30. How would you troubleshoot a slow web API?

Start with measurement rather than guessing.

Investigate:

  1. Request latency
  2. Application logs
  3. Database query duration
  4. External API calls
  5. CPU usage
  6. Memory usage
  7. Network latency
  8. Cache hit rate
  9. Thread pool/resource pressure
  10. Distributed tracing

The goal is to identify the actual bottleneck before optimizing.


18. Hands-on Exercise

Build a Simple Product API

Create an ASP.NET Core application that exposes:

GET    /api/products
GET    /api/products/{id}
POST   /api/products
DELETE /api/products/{id}

Requirements

Create a Product model:

public record Product(
    int Id,
    string Name,
    decimal Price);

Implement:

  • 200 OK for successful GET
  • 201 Created for successful POST
  • 404 Not Found for missing products
  • 204 No Content for successful DELETE
  • Validation for product data

Test

Use:

  • Browser
  • Swagger
  • Postman
  • curl

Goal

Be able to explain:

Client
 ↓
HTTP Request
 ↓
ASP.NET Core
 ↓
Endpoint
 ↓
Response
 ↓
Client

19. Mini Project

Mini Project: Product Catalog API

Build a small product catalog.

Features

  • List products
  • Get product by ID
  • Add product
  • Update product
  • Delete product
  • Search products
  • Pagination

Suggested Architecture

ProductCatalog
│
├── Controllers
├── Services
├── DTOs
├── Models
├── Data
├── Middleware
└── Program.cs

Optional Production Features

Add:

  • Global exception handling
  • Logging
  • Validation
  • Authentication
  • Authorization
  • Database persistence
  • Caching
  • Rate limiting
  • Health checks

Success Criteria

You should be able to explain the complete journey of:

GET /api/products/10

from browser/client to database and back.


20. Quiz

1. What translates a domain name into an IP address?

A. HTTP
B. DNS
C. JSON
D. TLS

Correct Answer: B — DNS

DNS translates domain names into IP addresses.


2. Which HTTP method is normally used to retrieve data?

A. POST
B. DELETE
C. GET
D. PATCH

Correct Answer: C — GET

GET is normally used to retrieve a resource.


3. Which status code means "Not Found"?

A. 200
B. 201
C. 404
D. 500

Correct Answer: C — 404

404 indicates that the requested resource could not be found.


4. What does HTTPS provide?

A. Database indexing
B. TLS-secured communication
C. Faster C# compilation
D. JSON serialization

Correct Answer: B — TLS-secured communication

HTTPS uses TLS to secure HTTP communication.


5. Which component usually sends the initial HTTP request?

A. Database
B. Client
C. Server CPU
D. SQL Server

Correct Answer: B — Client

A browser or application acts as the client.


6. What does a 500 status generally indicate?

A. Successful request
B. Client redirect
C. Server-side error
D. Authentication success

Correct Answer: C — Server-side error

5xx status codes represent server-side failures.


7. Which status code commonly represents successful resource creation?

A. 201
B. 301
C. 401
D. 503

Correct Answer: A — 201

201 Created indicates successful creation of a resource.


8. What is the main purpose of an API?

A. Store images
B. Connect software systems
C. Replace DNS
D. Compile C#

Correct Answer: B — Connect software systems

APIs define a communication interface between software systems.


9. Which component distributes requests across multiple servers?

A. DNS only
B. Load balancer
C. Browser cache
D. JSON

Correct Answer: B — Load balancer

A load balancer distributes traffic across backend instances.


10. Where does typical ASP.NET Core C# application logic execute?

A. Inside the user's browser
B. On the server
C. Inside DNS
D. Inside HTML

Correct Answer: B — On the server

ASP.NET Core executes server-side C# code and returns the resulting response.


21. AI Summary

One-Minute Revision

The web follows a simple fundamental model:

Client → Request → Server → Response → Client

When you enter a URL:

URL
 ↓
DNS
 ↓
IP Address
 ↓
HTTPS Connection
 ↓
HTTP Request
 ↓
ASP.NET Core
 ↓
Business Logic / Database
 ↓
HTTP Response
 ↓
Browser

Five-Minute Revision

Remember these seven concepts:

  1. Client — requests resources.
  2. Server — processes requests.
  3. DNS — resolves domain names.
  4. HTTP — defines web communication.
  5. HTTPS — secures HTTP using TLS.
  6. Request — client-to-server message.
  7. Response — server-to-client message.

Bullet-Point Summary

  • The web runs over the internet.
  • Browsers are common web clients.
  • Servers process requests.
  • DNS maps domains to IP addresses.
  • HTTP defines request/response communication.
  • HTTPS protects HTTP communication with TLS.
  • HTTP methods describe operations.
  • Status codes communicate results.
  • APIs allow applications to communicate.
  • ASP.NET Core processes HTTP requests through its pipeline.
  • Databases are commonly accessed during server-side processing.
  • Production systems require security, monitoring, scalability, and performance planning.

Key Takeaways

Think in this order:
URL → DNS → Connection → HTTP Request → Server → Application → Database → HTTP Response → Browser

Memory Tricks

HTTP Methods

GET = Get
POST = Produce/Create
PUT = Replace
PATCH = Partial change
DELETE = Delete

Status Codes

2xx → Success
3xx → Redirect
4xx → Client-side/request problem
5xx → Server-side problem

Authentication vs Authorization

Authentication → Who are you?
Authorization   → What can you do?

Flashcards

FrontBack
What does DNS do?Converts domain names into IP addresses.
What is HTTP?A protocol for client-server web communication.
What does HTTPS add?TLS-based security to HTTP communication.
What is a client?A system that sends requests.
What is a server?A system that processes requests.
What does GET usually do?Retrieves a resource.
What does 404 mean?Requested resource was not found.
What does 500 mean?Server encountered an error.
Authentication means what?Establishing who the user is.
Authorization means what?Determining what the user can access.

22. Cheat Sheet

WEB REQUEST CHEAT SHEET
────────────────────────────────────

User
  ↓
Browser / Client
  ↓
URL
  ↓
DNS
  ↓
IP Address
  ↓
HTTPS / HTTP Connection
  ↓
HTTP Request
  ↓
Web Server / Reverse Proxy
  ↓
ASP.NET Core
  ↓
Middleware
  ↓
Routing
  ↓
Controller / Endpoint
  ↓
Service
  ↓
Database / External API
  ↓
HTTP Response
  ↓
Browser

Common Methods

GET       → Read
POST      → Create / Process
PUT       → Replace
PATCH     → Partial Update
DELETE    → Delete

Common Status Codes

200 → OK
201 → Created
204 → No Content

301 → Moved Permanently
304 → Not Modified

400 → Bad Request
401 → Unauthenticated
403 → Forbidden
404 → Not Found
409 → Conflict
429 → Too Many Requests

500 → Internal Server Error
502 → Bad Gateway
503 → Service Unavailable
504 → Gateway Timeout

23. Comparison Table

HTTP vs HTTPS

FeatureHTTPHTTPS
EncryptionNo TLS encryptionTLS encryption
SecurityLowerHigher
Production usageGenerally inappropriate for sensitive trafficRecommended
Default port80443

Client vs Server

FeatureClientServer
Initiates requestUsuallyUsually responds
ExampleBrowserASP.NET Core
Runs UI codeYesNot typically
Runs server business logicNoYes
Accesses database directlyUsually noOften yes

Web vs Internet

FeatureWebInternet
MeaningInformation/application systemGlobal network infrastructure
UsesHTTP/HTTPSMany protocols
ExampleWebsiteNetwork connecting systems
RelationshipRuns over the internetProvides connectivity

Authentication vs Authorization

AuthenticationAuthorization
Identifies userChecks permissions
"Who are you?""What can you do?"
Login/token validationRole/policy/permission check

24. Key Takeaways

  • The web follows a client-server communication model.
  • The browser is usually the client.
  • The server processes requests and returns responses.
  • DNS resolves domain names to IP addresses.
  • HTTP defines how requests and responses are exchanged.
  • HTTPS protects HTTP communication using TLS.
  • HTTP methods describe the intended operation.
  • HTTP status codes communicate the result.
  • ASP.NET Core receives and processes HTTP requests.
  • APIs allow different applications to communicate.
  • Production web systems require security, scalability, performance, and observability.
  • Understanding the request lifecycle is fundamental to becoming a strong ASP.NET Core developer.

The most important mental model:
A web application is a conversation between a client and a server using standardized HTTP communication.


25. Revision Checklist

Before moving to the next topic, make sure you can explain:

  • What the web is
  • Difference between internet and web
  • Client and server
  • URL structure
  • DNS
  • IP address
  • Ports
  • HTTP
  • HTTPS
  • TLS
  • HTTP request
  • HTTP response
  • HTTP headers
  • HTTP methods
  • HTTP status codes
  • APIs
  • JSON
  • Authentication
  • Authorization
  • Reverse proxy
  • Load balancer
  • Basic web security
  • Basic web performance concepts

Interview Readiness Check

You should be able to answer this without memorizing:

"What happens when you type a URL into your browser and press Enter?"

A strong answer should mention:

DNS
→ IP address
→ Connection
→ HTTPS/TLS
→ HTTP request
→ Server
→ ASP.NET Core
→ Database/business logic
→ HTTP response
→ Browser rendering

26. Further Reading

Continue through the DotnetInterviewReady Getting Started roadmap:

  1. How does the web work? — Current topic
  2. Installing the .NET 10 SDK — Next topic
  3. Creating your first ASP.NET Core application
  4. ASP.NET Core Project Structure
  5. Program.cs
  6. Middleware
  7. Dependency Injection
  8. Routing
  9. Controllers and APIs

Last updated 10/9/2026

Your notes

Sign in to save personal notes on this topic — they'll sync across your devices.

Was this tutorial helpful?

Help us create more free learning resources. Learn more

Make a Donation