ASP.NET – How to add User Secrets

To add User Secrets in an ASP.NET project in Visual Studio do the following steps: Right-click the project and click Manage User Secrets. This will create and open a file called secrets.json. Override appsettings.json settings by putting them in secrets.json For example, let’s say your appsettings.json looks like this: You want to override ApiKey. In … Read more

ASP.NET – Use Swagger to generate API documentation

The simplest way to add API documentation is to use Swagger. You can configure it to generate an API documentation page and even send requests to your endpoints. Here’s what it looks like: In this article I’ll show how to install and configure Swagger with the following features (shown in the image above): Generates an … Read more

ASP.NET – Async SSE endpoint

Server-Sent Events (SSE) allow a client to subscribe to messages on a server. The server pushes new messages to the client as they happen. This is an alternative to the client polling the server for new messages. In this article I’ll show how to implement the messaging system shown in the diagram below. This uses … Read more