# Where Are the ASP.NET Core Source Code Files Located in the dotnet/aspnetcore Repository?

> Locate ASP.NET Core source code files within the dotnet/aspnetcore repository. Discover subfolders like src/Http, src/Mvc, and src/SignalR for easy navigation.

- Repository: [.NET Platform/aspnetcore](https://github.com/dotnet/aspnetcore)
- Tags: internals
- Published: 2026-08-01

---

**The ASP.NET Core source code files are located under the `src` directory at the root of the dotnet/aspnetcore repository, with each major subsystem organized into dedicated subfolders such as `src/DefaultBuilder`, `src/Http`, `src/Mvc`, and `src/SignalR`.**

The dotnet/aspnetcore repository on GitHub contains the complete implementation of the ASP.NET Core web framework. All production code resides in the top-level `src` folder, organized by functional area following a consistent `src/Component/src/` nesting convention. This structure separates core hosting, HTTP abstractions, MVC/Razor, SignalR, Identity, and other subsystems into distinct directories that contain both implementation files and corresponding test suites.

## The Root src Folder Structure

The `src` directory is the primary location for all **ASP.NET Core source code files**. Each major framework component occupies its own subdirectory, making it straightforward to locate specific implementations.

Key subdirectories include:

- **src/DefaultBuilder** – Core hosting and the minimal-API model (`WebApplication`, `WebApplicationBuilder`)

- **src/Http** – HTTP request/response abstractions, routing, and the middleware pipeline

- **src/Mvc** – Model-View-Controller pattern implementations including controllers and model binding

- **src/Razor** – Razor view engine and compilation services

- **src/SignalR** – Real-time communication hubs and protocols

- **src/Components** – Blazor server and WebAssembly components

- **src/Identity** – Authentication, authorization, and Identity entity definitions

- **src/DataProtection** – Cryptographic key management and data protection APIs

- **src/Configuration** – Configuration builders and providers

- **src/Logging** – Logging abstractions and implementations

- **src/Hosting** – Generic host abstractions and server integrations

- **src/HealthChecks** – Health check middleware and contributors

- **src/Authorization** – Policy-based authorization handlers

- **src/Caching** – In-memory and distributed caching abstractions

- **src/Antiforgery** – CSRF protection services

- **src/Session** – Session state management

- **src/Diagnostics** – EventSource and diagnostic listeners

Each folder follows a standard layout where production code lives in a nested `src/` folder (e.g., `src/Mvc/Mvc/src/`), with sibling `test/` and `samples/` directories containing unit tests and example applications.

## Key Source Files and Their Locations

The following table maps critical ASP.NET Core types to their actual file paths within the repository:

| Component | Source File Path | Key Type |
|-----------|------------------|----------|
| Minimal APIs | [`src/DefaultBuilder/src/WebApplication.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/DefaultBuilder/src/WebApplication.cs) | `WebApplication` |
| Minimal APIs | [`src/DefaultBuilder/src/WebApplicationBuilder.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/DefaultBuilder/src/WebApplicationBuilder.cs) | `WebApplicationBuilder` |
| HTTP Abstractions | [`src/Http/Http/src/HttpContext.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Http/Http/src/HttpContext.cs) | `HttpContext` |
| MVC Core | [`src/Mvc/Mvc/src/ControllerBase.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Mvc/Mvc/src/ControllerBase.cs) | `ControllerBase` |
| Razor Pages | [`src/Razor/Razor/src/RazorPage.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Razor/Razor/src/RazorPage.cs) | `RazorPage` |
| SignalR | [`src/SignalR/SignalR/src/Hub.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/SignalR/src/Hub.cs) | `Hub` |
| Blazor | [`src/Components/Components/src/ComponentBase.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Components/Components/src/ComponentBase.cs) | `ComponentBase` |
| Identity | [`src/Identity/Identity/src/IdentityUser.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Identity/Identity/src/IdentityUser.cs) | `IdentityUser` |
| Data Protection | [`src/DataProtection/DataProtection/src/DataProtectionProvider.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/DataProtection/DataProtection/src/DataProtectionProvider.cs) | `DataProtectionProvider` |
| Configuration | [`src/Configuration/Configuration/src/ConfigurationBuilder.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Configuration/Configuration/src/ConfigurationBuilder.cs) | `ConfigurationBuilder` |
| Logging | [`src/Logging/Logging/src/ILogger.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Logging/Logging/src/ILogger.cs) | `ILogger` |

These paths demonstrate the repository's organization: functional area followed by library name and source folder.

## Code Examples from the Source

Below are practical implementations that reference the actual source locations in the dotnet/aspnetcore repository.

### Creating a Minimal API with WebApplicationBuilder

The `WebApplication` and `WebApplicationBuilder` classes, defined in `src/DefaultBuilder/src/`, provide the entry point for modern ASP.NET Core applications:

```csharp
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();
app.MapGet("/", () => "Hello, ASP.NET Core!");
app.Run();

```

*Reference*: [[`src/DefaultBuilder/src/WebApplicationBuilder.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/DefaultBuilder/src/WebApplicationBuilder.cs)](https://github.com/dotnet/aspnetcore/blob/main/src/DefaultBuilder/src/WebApplicationBuilder.cs)

### Implementing Custom Middleware

HTTP middleware components interact with the `HttpContext` defined in `src/Http/Http/src/`:

```csharp
app.Use(async (context, next) =>
{
    Console.WriteLine($"Request: {context.Request.Method} {context.Request.Path}");
    await next();
    Console.WriteLine($"Response: {context.Response.StatusCode}");
});

```

*Reference*: [[`src/Http/Http/src/HttpContext.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Http/Http/src/HttpContext.cs)](https://github.com/dotnet/aspnetcore/blob/main/src/Http/Http/src/HttpContext.cs)

### Defining an MVC Controller

Controllers inherit from `ControllerBase`, located in `src/Mvc/Mvc/src/`:

```csharp
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
    [HttpGet]
    public IActionResult Get()
    {
        return Ok(new { Temperature = 72, Summary = "Warm" });
    }
}

```

*Reference*: [[`src/Mvc/Mvc/src/ControllerBase.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Mvc/Mvc/src/ControllerBase.cs)](https://github.com/dotnet/aspnetcore/blob/main/src/Mvc/Mvc/src/ControllerBase.cs)

### Using Data Protection APIs

The data protection stack resides in `src/DataProtection/`:

```csharp
var provider = new DataProtectionProvider(new DirectoryInfo(@"c:\keys"));
var protector = provider.CreateProtector("MyPurpose");
string protectedData = protector.Protect("SensitiveInfo");
string unprotected = protector.Unprotect(protectedData);

```

*Reference*: [[`src/DataProtection/DataProtection/src/DataProtectionProvider.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/DataProtection/DataProtection/src/DataProtectionProvider.cs)](https://github.com/dotnet/aspnetcore/blob/main/src/DataProtection/DataProtection/src/DataProtectionProvider.cs)

## Summary

- The **ASP.NET Core source code files** are located exclusively under the **`src`** folder at the repository root.
- Each major subsystem (Http, Mvc, SignalR, Identity, etc.) has its own dedicated subdirectory following the pattern `src/ComponentName/`.
- Production source files are nested within `src/Component/src/`, accompanied by `test/` directories for unit tests and `samples/` for example code.
- Key entry points like `WebApplication` and `HttpContext` reside in `src/DefaultBuilder/` and `src/Http/` respectively.

## Frequently Asked Questions

### Where is the WebApplication class defined in the source code?

The `WebApplication` class is defined in **[`src/DefaultBuilder/src/WebApplication.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/DefaultBuilder/src/WebApplication.cs)**. This file contains the implementation for the minimal API hosting model introduced in ASP.NET Core 6.0, providing methods for configuring the HTTP pipeline and running the application.

### How does the repository separate MVC from Razor source files?

MVC-specific source code, including `ControllerBase` and model binding logic, resides in **`src/Mvc/`**, while the Razor view engine implementation is located in **`src/Razor/`**. Both directories follow identical structural patterns with nested `src/` folders containing the actual implementation classes.

### Are test projects included alongside the source code?

Yes, each major component directory contains a **`test/`** subdirectory that mirrors the `src/` structure. For example, unit tests for the types in `src/Mvc/Mvc/src/` would be located in `src/Mvc/Mvc/test/`, ensuring test code remains organized and closely mapped to the corresponding production source files.

### What is the purpose of the src/Http directory?

The `src/Http` directory contains the foundational HTTP abstractions used throughout ASP.NET Core, including `HttpContext`, `HttpRequest`, and `HttpResponse`. These types, defined in files like [`src/Http/Http/src/HttpContext.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Http/Http/src/HttpContext.cs), provide the low-level primitives that higher-level features like MVC and SignalR build upon according to the dotnet/aspnetcore source code.