Skip to content

Practical samples of ASP.NET Core 2.1, 2.2, 3.1, 5.0 and 6.0 projects you can use. Readme contains explanations on all projects.

License

Notifications You must be signed in to change notification settings

skillmaker-dev/practical-aspnetcore

 
 

Repository files navigation

Samples for ASP.NET Core 6.0

WIP. We are converting samples to adapt to new features of C# 10 and .NET 6 here. It's almost done (tm).

Previous versions

5.0, 3.1 LTS, 2.1 LTS

Sections

Section
Blazor Client Side (Web Assembly) (22) Components, Data Binding
Blazor Server Side (15) Localization
Caching (5)
Configurations (7)
CoreWCF (1)
Dependency Injection (4)
Diagnostics (6)
Endpoint Routing (32)
Email (2)
Features (10)
Generic Hosting (9)
gRPC (including grpc-Web) (12)
Health Check (6)
IHttpClientFactory (5)
IHostedService (2)
Logging (3)
Localization and Globalization (6)
Middleware (14)
Mini Apps (1)
Minimal API
Minimal Hosting
MVC (47) Localization, Routing, Razor Class Library, Tag Helpers, View Component, etc
Orchard Core (4)
Path String (HttpContext.Request.Path) (1)
Razor Pages (9)
Request (14) Form, Cookies, Query String, Headers
Response (4)
SignalR (1)
Security (7)
Single File Application (2)
Static Files and File Provider (10)
System.Text.Json (11)
Syndications (3)
Testing (1)
URL Redirect/Rewrite (6)
Uri Helper (5)
Web Sockets (5)
Web Utilities (3)
Orleans (12)
Xml (1)
YARP (1)

For Data Access samples, go to the excellent ORM Cookbook.

How to run these samples

To run these samples, simply open your command line console, go to each folder and execute dotnet watch run.

Misc (8)

  • Application Environment

    This sample shows how to obtain application environment information (target framework, etc).

  • Show Connection info

    Enumerate the connection information of a HTTP request.

  • Keeping track of anonymous users

    Keep track of anonymous user in your ASP.NET Core (useful in scenario such as keeping track of shopping cart) using ReturnTrue.AspNetCore.Identity.Anonymous library.

  • Password Hasher server

    Give it a string and it will generate a secure hash for you, e.g. localhost:5000?password=mypassword.

  • Integrate Newtonsoft.Json back

    ASP.NET Core has a new built in JSON Serializer/Deserializer. This sample shows how to integrate Newtonsoft.Json back to your project.

  • Version info

    Show various version info of the framework your system is running on.

  • IApplicationLifetime

    Responds to application startup and shutdown.

    We are using IApplicationLifetime that trigger events during application startup and shutdown.

  • CommandLine

    This project shows a simple integration between System.CommandLine, a command line parsing library with ASP.NET Core app.

Server-Sent Events (1)

  • Forever Server

    This server will send a 'hello world' greeting forever.

Markdown (2)

Utils (3)

  • Status Codes

    Here we contrast between the usage of Microsoft.AspNetCore.Http.StatusCodes and System.Net.HttpStatusCode.

  • MediaTypeNames

    This class provides convenient constants for some common MIME types. It's not extensive by any means however MediaTypeNames.Text.Html and MediaTypeNames.Application.Json come handy.

  • MediaTypeNames - 2

    Using FileExtensionContentTypeProvider to obtain the correct MIME type of a filename extension.

Device Detection (1)

The samples in this section rely on Wangkanai.Detection library.

  • Device Detection

    This is the most basic device detection. You will be able to detect whether the client is a desktop or a mobile client.

Image Sharp (1)

All these samples require SixLabors.ImageSharp.Web middleware package. This middleware is an excelent tool to process your day to day image processing need.

  • Image-Sharp

    This example shows how to enable image resizing functionality to your site. It's super easy and the middleware takes care of caching, etc.

Misc

About

Practical samples of ASP.NET Core 2.1, 2.2, 3.1, 5.0 and 6.0 projects you can use. Readme contains explanations on all projects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 74.9%
  • HTML 20.2%
  • Batchfile 4.8%
  • Dockerfile 0.1%