Latest Articles

When you run a ASP.NET Core application using dotnet run CLI command, the application is started for you and made available at a specific URL and port. During development stage it's very common to make changes to C# code such as models, controllers, and other classes. To see these modifications in action you need to stop the application and again execute the dotnet run CLI command. Wouldn't it be nice if there is some way to detect such code changes and re-start the application automatically? Luckily, there is a tool called file watcher that does the trick. Let's see how.

In ASP.NET Core MVC and Web API are parts of the same unified framework. That is why an MVC controller and a Web API controller both inherit from Controller base class. Usually a Web API controller has maximum of five actions - Get(), Get(id), Post(), Put(), and Delete(). However, if required you can have additional actions in the Web API controller. This article shows how.

ASP.NET Core applications typically store configuration information in appsettings.json file. Although this default arrangement works in many situations, at times you need to store your application configuration in multiple physical files. Luckily, storing configuration in multiple files is not a big deal since ASP.NET Core by design supports this feature. However, you need to be aware of a few things involved in the process. This article discusses just that.

Logging is an important aspect of any professional web application. You often need to log data, information, errors, system events, and such things. ASP.NET Core comes with a set of inbuilt logging components that you can use for this purpose. To that end this article enumerates through seven things that are worth knowing about ASP.NET Core logging.

The anchor element allows you to render a hyperlink to a resource using its href attribute. There is a lesser known attribute of the anchor element - download - that can come handy in certain situations. The download attribute instructs the browser to download the resource as mentioned in the href attribute. Moreover, you can also specify the default file name for the download.

Some web applications application need to show data in real-time. As soon as the data is made available at the server, it immediately needs to be displayed to the end user. Traditionally developers used to poll the server periodically to check if a new data is available. This approach has its own drawbacks and may prove to be unsuitable in certain cases. Wouldn't it be nice if server notifies the client of new data rather than client checking with the server periodically? That is what HTML5 Server Sent Events (SSE) allow you to do. In this article you will learn what Server Sent Events or SSEs are and how to develop a ASP.NET Core application that receives real-time data from the server.

ASP.NET Core offers several ways to reuse your code and UI. One of them is View Components. Simply put a view component is a bundle of C# code, Razor code, and markup that occupies some screen real-estate. Unlike partial views a view component is more like a standalone widget housed in a view.

Recently I wrote this article explaining the cookie authentication in ASP.NET Core. A reader asked whether cookie authentication can be used with ASP.NET Core Web API and that too when the Web API is being consumed using HttpClient component. This article explains a possible solution to the problem.

If you have been working with ASP.NET Core, you are probably aware of ASP.NET Core Identity. ASP.NET Core Identity is a full-fledged framework to secure your websites. It comes with a lot of features such as external logins and Json Web Tokens (JWT) support. Ay times, however, you need something that is simple and gives you total control on various aspects of implementation such as data store and account manageemnt. That is where ASP.NET Core's Cookie Authentication can come handy. In this article you will learn what Cookie Authentication is and how to configure it to secure your websites.

ASP.NET Core Razor Pages offer a simple page based programming model for the developers. A razor pages consists of a .cshtml files and associated page model class. The page model class can house actions to handle HTTP verbs. For example, a page model class can contain OnGet(), OnPost(), OnPut(), and OnDelete() actions to deal with GET, POST, PUT, and DELETE verbs respectively. This sounds straightforward as far as requests are initiated by a form. However, things are bit tricky while making Ajax calls to a razor page. To that end this article illustrates how to develop a razor page that performs CRUD operations using Ajax calls.