Know Further About ModelState in ASP.NET 5.0

In this post, we’re going to explain what the ModelState is, and what it is used for. We’ll also show how to use it to validate our POSTed inputs, and do simple custom validation. Here we go! What is the ModelState? In short, the ModelState is a collection of name and value pairs that are submitted to the server […]

Read more
Using ASP.NET Core to Find Controllers in Your App

In this post I describe application parts and how ASP.NET Core uses them to find the controllers in your app. I then show how you can retrieve the list at runtime for debugging purposes. Debugging a missing controller A while ago I was converting an ASP.NET application to ASP.NET Core. The solution had many class […]

Read more
Using IHttpClientFactory in ASP.NET Core

In today’s post, we will see how to create named HTTPClient requests using HTTPClientFactory in .NET Core or ASP.NET Core. Create a Named HTTPClient Create an ASP.NET Core Project Let’s look at step by step to understand and create named HTTPClient approach where we shall be creating HTTPClient request object using HTTPClientFactory. Interface IHTTPClientFactory  can be injected in Controller […]

Read more
Using Mailkit to Send Email ASP.NET Core 3.1

This post is an example how to send email in Asp.net Core 3.1 using Mailkit. I assume that you have downloaded it and install it on your server. How to Send HTML Email in ASP.NET Core This code sends a simple HTML email using the Ethereal free SMTP testing service, you can create a free test account […]

Read more
How to Detect Session Timeout and Redirect to Login Page in ASP.NET

This is example of Detecting Session Timeout and Redirect to Login Page in ASP.NET, session timeout occurs when user is idle for the time specified as in web.config file. 1st Method In web.config file, set the sessionstate mode to inproc and authentication mode to Forms I’ve created three pages in this example , one is login […]

Read more
How to Wiring up Ninject with ASP.NET Core 2.0

Ninject is a lightning-fast, ultra-lightweight dependency injector for .NET applications. It helps you split your application into a collection of loosely-coupled, highly-cohesive pieces, and then glue them back together in a flexible manner. By using Ninject to support your software’s architecture, your code will become easier to write, reuse, test, and modify. To test if the […]

Read more
How to Automate Reload Configuration in ASP.NET Core

In this article, I want to explore IOptionsSnapshot and show how to work with IOptionsSnapshot in ASP.NET Core 1.1. We will use the dot-net CLI to create a new project and configure it using the reload technique in combination with IOptionsSnapshot. Make sure you are using at least ASP.NET Core 1.1. Get started by creating […]

Read more
ASP.NET Core – How it Works?!

The hosting model for ASP.NET Core is dramatically different from previous versions of ASP.NET. This is also one area where I’ve seen a fair amount of misunderstanding. ASP.NET Core is a set of libraries you can install into a project using the NuGet package manager. One of the packages you might install for HTTP message […]

Read more