ASP.NET Core

How To Post Data In ASP.NET Using AJAX  Form Serialization

How To Post Data In ASP.NET Using AJAX Form Serialization

Welcome to mycodebit. When we work with ASP.NET (Core) MVC we have to submit the forms through razor pages so, in this article, we discuss How To Post Data In ASP.NET Using AJAX Form Serialization. I'm using visual studio 2019 for this tutorial. If you have not created the project yet please follow this link to create a new project. Steps: Let's first create a model that we will use to submit the form data and we will create this model class as per our requirement to transfer data. public class SubmitPersonalInfo { public string Name { get; set; }…
Read More
How to Create PDF Document in ASP.NET Core 6 Web API

How to Create PDF Document in ASP.NET Core 6 Web API

Welcome to mycodebit.com.In this article we will learn How to Create PDF Document in ASP.NET Core 6 Web API. This is a very common task that we face daily as an ASP.NET Core web developer. In this post, I'm using Visual Studio 2022 and .NET version 6.0. You can download the complete source code from here. Let's start with the practical. Create a new Project: To create a new project first open visual studio and click on "create a new project". After that select "ASP.NET Core Web API" as a project template. Configure Project: Configure the project setting after project…
Read More
How to improve ASP.NET Core 6 Web API Performance

How to improve ASP.NET Core 6 Web API Performance

Welcome to the post; today, we will discuss How to improve ASP.NET Core 6 Web API Performance. We have summarised vital factors that can efficiently improve ASP.NET Core Web API performance. Let's discuss the points. 1- Minimize allocations of large objects: In ASP.NET Core apps, the default garbage collector removes the allocations and releases the memory automatically. So we developers do not have to worry about garbage collection, and how and when the memory is freed. But the issue is a garbage collector takes a lot of CPU time to clean unreferenced objects from memory, huge objects. Because large objects…
Read More
Save Activity Log in ASP.NET Core Web API like a Pro

Save Activity Log in ASP.NET Core Web API like a Pro

In Any Web Application activity logs are the most important and common thing. Today we will learn how can we save activity log in ASP.NET Core Web API project. There are many ways to perform this task but we are going to discuss one of the efficient ways with you. We will keep record of activity logs by overriding our savechanges() and savechangesasync() method. Tools: For this project, I’m using Visual studio community 2019, windows os, and .NET Core Version 5. Let’s Start: To save logs we have to create a table in our database. Create a class and name…
Read More
Logging Exceptions in ASP.NET Core Web API

Logging Exceptions in ASP.NET Core Web API

Logging Exceptions in ASP.NET Core is a very important thing even in any web application. When we have a lot of users on our application so it will be very easy for us to track the exception and solve this by simply checking the exception records. We do not have to test a lot to find the error. In this tutorial, we will learn how we can log errors into our database in the ASP.NET Core Web API project. Tools: We are using Visual Studio Community 2019, .NET Core version 5, and MSSQL Database. Lets start: To add exception logs…
Read More
How to throw Custom Exceptions in ASP.NET Core Web API

How to throw Custom Exceptions in ASP.NET Core Web API

We can handle our errors/exceptions by simply using try-catch blocks. But What if we have to throw custom exceptions on some error. To achieve this custom exception throw approach follow the below-mentioned tutorial. Custom exception handling and throwing custom exceptions is very important to maintain a standard Web Application. It will create a difference and your code will look more clean and standard. In this post, we are going to learn that how can we throw custom exceptions in our ASP.NET Core Web API project.  Tools: Visual Studio Community 2019 Windows OS Let’s get started: If we have to throw…
Read More
How to pass an Object as a query parameter in Get API request ASP.NET Core

How to pass an Object as a query parameter in Get API request ASP.NET Core

By reading this title some beginners and new to programming peeps will be amazed that how can we pass a JSON object as a query parameter in "Get" type API using ASP.NET Core. In this post, we will discuss and learn that how can we perform this task in our ASP.NET Core Web API project. It is very simple and easy. Tools: Visual Studio Community 2019 Windows OS Let's get started: We will perform this task in the ASP.NET Core Web API project. If you want to create ASP.NET Core N-tier Application you can set it up by following this…
Read More
How to Use ReCaptcha V3 in ASP.NET Core MVC

How to Use ReCaptcha V3 in ASP.NET Core MVC

In this post, we are going to use Google reCaptcha V3 in ASP.NET Core MVC project. First thing first how a Google reCaptcha V3 works. In reCaptcha V3 user doesn't interact with any reCaptcha verification directly or solve any puzzle. In V3 we configure a Google API on the front-end that returns us a token and on the server-side. We call another google API that confirms the token. After confirming the token, Google Server-side API verifies the user's response/token responses to us with a success score that can be 0 to 0.1. If the score is near 0.1 it means…
Read More
Set Up 3-tier architecture in Asp.Net Core Web API Application

Set Up 3-tier architecture in Asp.Net Core Web API Application

The project we are about to set up is a 3-tier architecture in Asp.Net Core Web API Application and using the .Net core 5 version. In this tutorial, we will create a main front-tier Asp.Net Core Web API project and create the other 3-tiers for Services, Model, Data. All these tiers and project is completely explained below. Tools that I’m using: Windows OS Visual Studio Community 2019 Project Set-Up: First of all, we will set up a web API project. Open Visual Studio and follow the below steps. Now name your project and select a location. Select Version of .Net…
Read More