In-Memory Logins in ASP.NET Core with JWT

Introduction

Some line of business (LOB) applications or internal systems have a predefined set of users and corresponding login information. In situations like those, using a database mechanism to store user information is an overhead. Combine this overhead with Microsoft’s heavy-duty implementation of the Identity framework with persisting concerns in the Entity framework, and you have a recipe for a headache. Those frameworks might be useful in certain situations, but here we have a limited scope and, in situations like this, we can, instead, take a lighter approach towards this functionality.

In this post, we will look at a way to implement authentication functionality in an ASP.NET Core Web application. We will go through all the steps and how things are put together to achieve the desired result. The source code is available in this GitHub repository.

Working With dotConnect for SQL Server in ASP.NET Core

dotConnect for SQL Server is a fast ORM for SQL Server from Devart that is built on top of ADO.NET and provides you an opportunity to connect to SQL Server databases from .NET or .NET Core applications. dotConnect for SqlServer, earlier known as SQLDirect.NET, is a fast, scalable data access framework that can be used in WinForms, ASP.NET, etc. This article talks about the features and benefits of dotConnect for Sql Server and how we can work with it in ASP.NET Core.

Prerequisites

To be able to work with the code examples demonstrated in this article, you should have the following installed in your system:

ASP.NET Core Structured Logging — Introduction

Hi all! In this post, we'll see what's the difference between "standard" and "structured" logging and how the latter can help us tracing down issues in our systems.

But first, let's begin with a question. Ever had to go through countless log messages to find a single tiny entry?

ASP.NET Core 3.0 Blazor CRUD With Azure SQL

Introduction

Blazor is one of the latest trending stacks among developers, specifically Cloud developers. In this video, I will be presenting you with how to connect an ASP.NET Core 3.0 Blazor C# application to an Azure SQL database using Visual Studio 2019.

Prerequisites

  • A valid Azure subscription or Azure free account. 
  • Visual Studio 2019.
  • Zeal to learn.

Watch

                 

Health Checks with ASP.NET Core and Kubernetes

Health checks are a fundamental part of our APIs. I guess they fall in that category of "non-functional-but-heavily-required" things. More or less like a good part of the infrastructure code.

They don't add business value per se but have an enormous impact for those in IT, like DDD and design patterns. You can normally see them in conjunction with container orchestration or monitoring tools to ensure that the system is alive and kicking.

Upload Files Using ASP.NET Web API and React.js

File Upload Using ASP.NET Web API and React.js

Introduction

In this tutorial, we will learn how to upload files, images or videos using ASP.NET Web API and React.js. React.js is an open-source JavaScript library used for creating user interfaces, particularly for SPA. It is also used for controlling the view layer for web and mobile applications.

Building a List With ASP.NET Core

I’ve recently been working with ASP.NET Core to build some functionality involving building a list of values. Typically, with ASP.NET  Core using Razor, you have a form that may look something like this:

@using (Html.BeginForm("MyAction", "ControllerName", FormMethod.Post)
{
    @Html.AntiForgeryToken()
    <div class="form-group">
        @Html.LabelFor(model => model.MyValue)
        @Html.TextBoxFor(model => model.MyValue)
    </div>

    <div class="form-group">
        <button type="submit">Submit</button>
    </div>


This works really well in 90% of cases, where you want the user to enter a value and submit. This is your average CRUD application; however, what happens if, for some reason, you need to manipulate one of these values? Let’s say, for example, that you want to submit a list of values.

A Dynamic Task Scheduler for ASP.NET Core

There are many task schedulers for ASP.NET. Two of the more famous ones are Quartz.NET and Hangfire. Both of these are amazing tools, and I have personally used Hangfire myself with great success. But, they both suffer from a lack of flexibility and/or complexity in usage. 

Quartz.NET suffers from an overly complex API, based upon configuration files, in a difficult to understand format, giving you no syntax highlighting or AutoComplete when you declare your tasks. In addition, the amount of code required to actually create a simple task sometimes feels staggeringly large and unnecessarily complex. The fact that it was "ported" from Java shows as you try to learn its API.

How to Migrate a Project From ASP.NET MVC to ASP.NET Core

Join the rest of the flock, get going with ASP.NET Core

Step-by-Step Guide

Here is a practical guide on migrating a project from ASP.NET MVC framework to ASP.NET Core. The step-by-step instructions written by the team working on the nopCommerce open-source project, and they can be easily applied to any ASP.NET MVC project.

We can say with confidence that we were the first large project to carry out such a migration. In this guide, we tried to put together the entire migration process in a structured form and describe various bottlenecks so that other developers could rely on this material and follow the roadmap when solving the same task.

Use OAuth 2.0 to Secure Your ASP.NET Core App

Imagine having an app where you can write and store your notes efficiently. Today, we are going to build an app that will keep track of your notes. We’ll use ASP.NET Core to build the app. We’ll also use .NET Core’s OAuth 2.0 authentication middleware to make sure the personal notes are kept secure.

My Private Notes App

As mentioned earlier, you'll use an ASP.NET app to build your note-keeping app. Here's how the app works: The home page will keep track of all your recent notes, and if you include more than three notes, the oldest will be shelved. Once we've built the app, you'll learn how to secure it with OAuth. Read this starter project from GitHub to get started. 

Login and Registration ASP.NET Web API Using Angular 8

In this article, we will learn the step by step process of creating login and registration pages in a Web API using Angular 8 using the following technologies: 

  • ASP.NET Web API.
  • Angular 8.
  • SQL Server.
  • Bootstrap.
You may also like: Angular 8: All You Need to Know.

Prerequisites

  • Basic knowledge of Angular and Web API.
  • Visual Studio Code and Visual Studio IDE should be installed.
  • SQL Server Management Studio.
  • Nodejs should be installed.

Step 1

Open SQL Server Management Studio, create a database named Employee, and in this database, create a table. Give that table a name like Employeemaster.

ASP.NET Core and Its Effectiveness in Building Web Applications

Is ASP.NET Core right for your development needs?

Earlier, businesses didn’t have multiple options to develop customized web applications with unique features using cutting-edge programming languages. To offer the optimal user experience, they had to invest more in infrastructure. Today, digitization has revolutionized the software industry. When it comes to building a web application, there are multiple technologies to pick from, and ASP.NET Core is prime amongst them.

ASP.NET core is an open-source web framework from Microsoft. Released in 2016, this web framework is one of the best alternatives to Windows-hosted ASP.NET applications.

NLog with Docker Compose

Hi All,

Any suggestions on how could we attach the NLog.config to a docker-compose.yml file so that it generates an NLog_Internal.txt on the host machine and we can see all the application logs in that file?
In other words, is there a way we could extract the logs of an application running inside a Docker container using NLog on a specified location (local disk or cloud)?

I have tried creating an ASP.NET Core application with the following NLog.config file:

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true"
      throwConfigExceptions="true"
      internalLogLevel="Trace"
      internalLogToConsole="true">

  <variable name="dockerlogDirectory" value="/data/logs/app"/>

  <targets>
    <target xsi:type="File" name="ownFile" fileName="${dockerlogDirectory}/MyCustomLog-${shortdate}.log"
            layout="${longdate}|${logger}|${uppercase:${level}}|${threadid}:${threadname}|${message} ${exception}" />
    <target xsi:type="Console" name="console" />
    <target xsi:type="Null" name="blackhole" />
  </targets>

  <rules>
    <logger name="*" minlevel="Trace" writeTo="console" />
    <logger name="Microsoft.*" minlevel="Trace" writeTo="blackhole" final="true" />
    <logger name="*" minlevel="Info" writeTo="ownFile" />
  </rules>

</nlog>

Thanks.

How to Organize Your ASP Core’s Startup File

If you're a developer used to working with ASP.NET Core, you should be familiar with the nightmare that is startup file organization. Every ASP Core application startup file can include configurations, middleware declaration, dependency injection definition, authentication configs, and policies amongst. Long story short, heavy applications can have large, messy, unreadable startup files with hundreds of lines of hard-to-scroll-through code.

Gordon on ASP.NET's startup file organization

So, as you might have guessed, here is where extension methods come to the rescue. Learning to organize your Startup.cs is part of being a good C# programmer; having extension methods in your arsenal is a must. By the end of this article, you will learn a neat and simple trick to improve the organization of your startup files and spare yourself the pain of endless startup file scrolling in your future projects. 

Dependency Injection in Azure Functions

Azure Functions V2 supports ASP.NET Core functions like dependency injection. It is especially good if we write wrapper functions for shared libraries and components we are also using in web and other applications of our solution. This blog post shows how to use dependency injection in Azure Functions.

To get started with the code, check out Azure Functions with DI GitHub repository by @MikaBerglund. It's simple and minimal Visual Studio solution without any overhead.