Thoughts on .Net & Coding
.Net Articles, tutorials, reviews, code and more...
-
Dealing with MongoDB DateTime in ASP.NET Core
MongoDB is one of the popular NoSQL databases available today. You can use MongoDB database in your ASP.NET Core applications using MongoDB.Driver NuGet package. I discussed the basics of MongoDB including CRUD operations here and here. Document databases such as MongoDB store data as JSON documents. Although JSON supports basic data types such as string, number, and boolean JSON doesn't support DateTime. So, date-time values are stored as string. In this article we will discuss a few things that you need to take into account while storing date-time values.
-
Store and retrieve files from Azure blob storage
ASP.NET Core web applications often need to store files on the server. One of the approaches to storing files on the server side is to store them into Azure blob storage. For example, you can store documents, audio files, video files, and images into Azure blob storage. This article shows you how to add, download, and remove files from Azure blob storage.
-
Reuse UI with Partial Views in ASP.NET Core MVC and Razor Pages
While developing ASP.NET Core web applications you often need to reuse parts of the user interface across many view or razor pages. There are multiple options to address this requirement simplest being Partial Views. In this article you will learn what partial views are and how to use them in ASP.NET Core MVC and Razor Pages applications.
-
Use Cache and Distributed Cache Tag Helpers in ASP.NET Core
Web developers often look for opportunities to boost the performance of their web applications. ASP.NET Core provides server side caching in the form of in-memory and distributed cache implementation. Moreover, it offers two Tag Helpers to implement cache HTML content of razor views or razor pages - Cache and Distributed Cache. To that end this article discusses these Tag Helpers in brief.
-
Handle Unknown Actions in ASP.NET Core MVC
While working with ASP.NET Core MVC, usually you have known number of actions and views. At times you might come across a situation where you need to deal with actions unknown at development time. Let me briefly explain a situation I recently stumbled upon.
-
Three ways to return data from ASP.NET Core web API
ASP.NET Core allows you to build RESTful services using web API. Typically you want to return data and HTTP status codes from an API controller. To that end there are three ways to return values from an API controller. This article discusses them with an example.
-
Enable CORS in ASP.NET Core API
Browsers do not allow cross origin communication for security reasons. This means if an ASP.NET Core web API housed in one web app is called by JavaScript code running as a part of another web app, the communication attempt will fail. However, you can alter this default behavior by adding some configuration in your API application. To that end this article discusses how that task can be accomplished.
-
Reverse Engineering EF Core Model and Data Validation Techniques
While working with ASP.NET Core and Entity Framework Core you need to create data model for your application. This calls for creating a DbContext class along with one or more entity classes. Luckily, EF Core allows you to reverse engineer the model from an existing database. To that end this article discusses how that can be accomplished.
-
Use XML format with ASP.NET Core web APIs
In one of my past articles I discussed how to deal with XML data in ASP.NET Web APIs. Although JSON is quite popular format in API communication, at times you might need to handle XML data. To that end this article describes the required configuration with a simple example.
-
JWT authentication in ASP.NET Core using HttpClient
In my last two articles (you can read them here and here) we discussed how JWT authentication can be implemented in ASP.NET Core APIs and jQuery client. In this article we will use .NET Core's HttpClient component to perform JWT authentication.