Latest Posts On Code Maze

Authentication With ASP.NET Core Identity

Authentication With ASP.NET Core Identity

Authentication is the process of confirming a user’s identity. It is a set of actions, we use to verify the user’s credentials against the ones in the database. For the user to be able to provide credentials, our application requires a Login page with a set of fields...

OWASP Top 10 – Injection

OWASP Top 10 – Injection

The injection attack is the most critical web application security threat as per OWASP Top 10 list. In this article, we are going to look at the Injection attack in detail. To download the source code for this article, visit the OWASP - Injection GitHub Repo. To see...

User Registration with ASP.NET Core Identity

User Registration with ASP.NET Core Identity

With ASP.NET Core Identity fully registered we can learn how to perform user registration actions in our project. User registration is the process of registering users in our application by saving their credentials in the database. So, in this article, we are going to...

Introducing Identity to the ASP.NET Core Project

Introducing Identity to the ASP.NET Core Project

In this article, we are going to learn about ASP.NET Core Identity implementation in the ASP.NET Core project. ASP.NET Core Identity is the membership system for web applications that includes membership, login and user data. But, it is not just a user store, it is...

How to Send an Email in ASP.NET Core

How to Send an Email in ASP.NET Core

In this article, we are going to learn how to send an email in ASP.NET Core. We are going to start with simple project creation and creating a basic email configuration. Once we are finished with that, we are going to install the required MailKit library and create...

HATEOAS in ASP.NET Core Web API

HATEOAS in ASP.NET Core Web API

HATEOAS, Hypermedia as the Engine of Application State, is the REST constraint that says a response carries the links describing what the client can do next. Instead of building URLs from a documented template, the client reads them out of the payload it already has....

Data Shaping in ASP.NET Core Web API

Data Shaping in ASP.NET Core Web API

Data shaping lets the client decide which fields come back. A request for /api/owners?fields=name,dateOfBirth returns owners carrying those two properties and nothing else. The pattern travels under several names. JSON:API calls it sparse fieldsets, Google's API...

Sorting in ASP.NET Core Web API With a Dynamic OrderBy

Sorting in ASP.NET Core Web API With a Dynamic OrderBy

Sorting a Web API means turning a query string like ?orderBy=name,dateOfBirth desc into an ORDER BY clause the database runs. The client names the fields at request time, so the ordering cannot be written into the code ahead of it. That is the whole problem in one...

Searching in ASP.NET Core Web API With Query Parameters

Searching in ASP.NET Core Web API With Query Parameters

Searching in a Web API means accepting a free-text term as a query parameter and narrowing the result set to the rows that contain it. One extra property on the parameters class, one Where() call in the repository, and GET /api/owners?name=anna works. Searching is not...

Filtering Data in ASP.NET Core Web API

Filtering Data in ASP.NET Core Web API

Filtering a Web API means letting the client narrow a collection endpoint with query-string parameters the API has declared: ?minYearOfBirth=1975&maxYearOfBirth=1997 returns only the owners born in that range. This is not the same thing as an ASP.NET Core filter....

Protecting Data with IDataProtector in ASP.NET Core

Protecting Data with IDataProtector in ASP.NET Core

In this article, we are going to learn about the ASP.NET Core built-in data protection mechanism, IDataProtector, which we can use to encrypt and decrypt our sensitive data. Encryption and decryption are not the only features we are going to cover. We will also show...

Pagination in ASP.NET Core Web API: How to Implement Paging

Pagination in ASP.NET Core Web API: How to Implement Paging

Pagination in an ASP.NET Core Web API means the client asks for a slice of a collection, ?pageNumber=2&pageSize=10, and the API answers with those ten records plus the numbers needed to ask for the next ten. Two things have to be built. A parameters class binds...

System Testing a REST API using C# and DalSoft Rest Client

System Testing a REST API using C# and DalSoft Rest Client

In this post, we're going to cover the recent extensions to the DalSoft RestClient library which allows you to easily test a REST API using C#. This post is aimed at anyone (devs, testers, etc) who tests REST APIs and is suitable for all levels. If you haven’t written...

Getting Started with AutoMapper in ASP.NET Core

Getting Started with AutoMapper in ASP.NET Core

In this article, we are going to learn how to use AutoMapper in an ASP.NET Core application. We are going to start by looking into what AutoMapper is and what problem it solves. Then, we are going to explain how we can use AutoMapper in our MVC application. After...

Differences Between .NET Framework, .NET Core, and .NET Standard

Differences Between .NET Framework, .NET Core, and .NET Standard

Since the birth of various .NET implementations and .NET Standard, there has been a lot of confusion regarding these topics in the development community. We will try to eliminate that confusion by explaining these topics in a simple and understandable way. Let's start...

Automated UI Tests with Selenium and ASP.NET Core

Automated UI Tests with Selenium and ASP.NET Core

Selenium is a library that helps us automate browser behavior. We can use it for different purposes, but its primary use is for automated UI testing of web applications. In this article, we are going to use Selenium to write automated UI tests and with that finish our...

Integration Testing in ASP.NET Core

Integration Testing in ASP.NET Core

In this article, we will learn about Integration Testing in ASP.NET Core. Additionally, we will prepare an in-memory database so we don’t have to use the real SQL server during integration tests. For that purpose, we will use the WebApplicationFactory class. [sc...

xUnit Testing in C# and ASP.NET Core

xUnit Testing in C# and ASP.NET Core

xUnit is a unit testing framework for .NET. A test is a public method marked [Fact], or [Theory] when the same method should run once per set of inputs, and Assert decides whether it passed. The framework builds a fresh instance of the test class for every single...