This repository contains multiple ASP.NET Core projects and examples, demonstrating middleware, routing, controllers, static files, and more. Each folder is a self-contained sample or learning module.
- Demonstrates conditional middleware logic using the
UseWhen
extension.
- A simple web application for further extension and experimentation.
- Demonstrates environment-specific configuration and usage in ASP.NET Core projects. See
Environments/MyEnvironments
for examples of usingappsettings.json
andappsettings.Development.json
to manage settings for different environments (Development, Production, etc).
- Contains examples for managing and displaying social media links in ASP.NET Core apps. See
SocialMediaLinks/MySocialMediaLinks
for sample code and configuration for handling social media URLs, icons, and environment-specific settings.
-
Contains unit test examples for ASP.NET Core projects. See
CRUD/MyUnitTest
for sample test classes and usage of xUnit for testing business logic, controllers, and services. Run tests with:dotnet test CRUD/MyUnitTest/MyUnitTest.csproj
-### Prerequisites
- .NET 9 SDK
- macOS, Windows, or Linux
-### Build and Run
- Clone the repository:
git clone https://github.com/EdmondAndy/aspnet.git
cd aspnet
- Build a project (example for MyMiddleware):
dotnet build MiddleWare/MyMiddleware/MyMiddleware.csproj
You can build other projects similarly by specifying their .csproj
file.
- Run a project (example for MyWebApp):
dotnet run --project WebApp/MyWebApp/MyWebApp.csproj
Replace the project path as needed for other samples.
-### Folder Details
-
appsettings.json
andappsettings.Development.json
: Configuration files for each project. -
Program.cs
: Main entry point for each application. -
Properties/launchSettings.json
: Debug and launch settings. -
Controllers/
: Contains controller classes for handling HTTP requests. -
wwwroot/
: Static files (PDFs, images, etc.) served by the app. -
Environments/
: Contains projects and examples for environment-based configuration and settings.
-### Contributing Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
-### License This project is licensed under the MIT License.
Implements custom middleware components for ASP.NET Core. Useful for learning how to intercept and process HTTP requests.
Shows how to use the UseWhen
extension to conditionally apply middleware based on request criteria.
A simple web application built with ASP.NET Core, suitable for further extension and experimentation.
- .NET 9 SDK
- macOS, Windows, or Linux
- Clone the repository:
git clone https://github.com/EdmondAndy/aspnet.git
cd aspnet
- Build a project:
dotnet build MiddleWare/MyMiddleware/MyMiddleware.csproj
dotnet build UseWhen/MyUseWhen/MyUseWhen.csproj
dotnet build WebApp/MyWebApp/MyWebApp.csproj
- Run a project:
dotnet run --project MiddleWare/MyMiddleware/MyMiddleware.csproj
dotnet run --project UseWhen/MyUseWhen/MyUseWhen.csproj
dotnet run --project WebApp/MyWebApp/MyWebApp.csproj
appsettings.json
andappsettings.Development.json
: Configuration files for each project.Program.cs
: Main entry point for each application.Properties/launchSettings.json
: Debug and launch settings.
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.