Posts

Showing posts from June, 2025

Azure AI Search: Indexers and Indexes using C# Code

Image
In this article, we will implement the Azure AI Search Service Data Source, Index, and Indexer creation using the C# code. We will implement the process using the ASP.NET Core 9 APIs. The application targets not only to configure Azure AI Search but also the application exposes API endpoints to perform search operations on the Data Source configured with Azure AI Search.  Formally known as Azure Cognitive Search, the Azure AI Search is an enterprise-ready information retrieval system. We can build the heterogeneous contents information ingestion into search index e.g. Documents, Relational Data, etc to query so that the data can be retrieved. Teh Azure AI Service is designed for high-performance and scalability. Some of the features of Azure AI Search are as follows: Rich Indexing capabilities with content transformation, data chunking, vectorization for RAG. Vector and full-text search for data retrieval with efficiency. Advanced Query syntax Integration with other Azure Cloud hos...

ASP.NET Core 9: File Upload using APIs with IFormFile and Anti-Forgery Token

Image
In this micro article, we will be discussing the important change in File Upload feature in ASP.NET Core 9 for IFormFile. I have already written an article for File upload using Minimal APIs on this link . This article is an enhancement in that article. In ASP.NET Core 9, a strict anti-forgery validation for file uploads for IFormFile. While using Minimal APIs endpoints, for file upload using IFormFile or IFormFileCollection, we need to pass an Anti-Forgery token into the HTTP request header. This token will be validated before completing the file upload operations.   The Minimal API must use the Anti Forgery Token Service as well as the Anti Forgery Token Middleware else the exception will be thrown. The reason behind the change is for the security precaution for the API that consumes data posted form the form. Although we can disable the Anti Forgery token it is not recommended, please avoid it for the production.  In the Minimal API project created with ASP.NET Core 9,...