How to Implement Windows Authentication in ASP.NET MVC

This is a demo of Windows Authentication implemented in .NET MVC, similar to what I did for an internal site in our organization. I needed to re-implement a legacy application to use Role-based instead of User-based authentication. The legacy application had hard-coded individual users in the Authorize attribute of the controller (which was perfectly fine). Unfortunately, because it was deployed as […]

Read more
How to Allow Proxy to Another URL with ASP.NET Core

This post talks about writing a simple HTTP proxy logic in C# or ASP.NET Core. And allowing your project to proxy the request to any other URL. It is not about deploying a proxy server for your ASP.NET Core project. Before starting, you need to be clear about the target you are going to proxy […]

Read more
How to Upgrade from .NET Core 3.1 to .NET 6.0

.Net 6 is an LTS (Long Tern Support) Version. It will be supported for three years. It is the latest long-term support release. The previous version, .Net Core 3.1 support will be finalized in December 2021, and support for .Net 5 will be ended May 2022. This article describes how to upgrade the solution from […]

Read more
How to Improve HTTP Performance in Xamarin Applications

Any mobile application that depends greatly on HTTP requests can be a source of frustration. Mobile devices are constantly running slow connections, losing connectivity entirely, or switching from Wi-Fi to cellular. As an app developer, you really don’t want to mess with any of this. You want your app to *just work*, and your users […]

Read more
How to Redirect a Request in ASP.NET Core MVC

ASP.NET Core is a cross-platform, open source, lean, fast, and modular framework for building high-performance web applications. ASP.NET Core MVC applications enable you to redirect a request to a specified URL in several different ways. This article talks about how we can accomplish this with code examples wherever appropriate. To work with the code examples […]

Read more
How to Host ASP.NET Core in Window Service

Did you know that we can host ASP.NET service on Windows with Windows Service without using IIS? The benefit of hosting on Windows Service is that the application will automatically restart after the server reboot. This functionality is implemented using a Worker Service Template that becomes the initial point for writing and building long-running service […]

Read more
ASP.NET Core 6 Hosting with ASPHostPortal

ASPHostPortal is one of the most popular ASP.NET Core hosting providers out there. They host over million domains currently. They offer a wide range of hosting options, plans at different price points, and phenomenal customer support. Whether you’re a small blog, medium-sized business, or large online store, ASPHostPortal has an option for you.  In a […]

Read more
How to Use Entity Framework Connect to SQL Server

This post shows goes through the steps to connect a .NET 6 API to SQL Server using Entity Framework Core, and automatically create/update the SQL Server database from code using EF Core migrations. We’ll start with an example .NET 6 CRUD API from a tutorial I posted recently, it uses the EF Core InMemory db […]

Read more
How to Handle Exceptions, Validations in ASP.NET Core Web API

This post looks at the best ways to handle exceptions, validation and other invalid requests such as 404s in ASP.NET Core Web API projects and how these approaches differ from MVC error handling. Why do we need a different approach from MVC? In .Net Core, MVC and Web API have been combined so you now […]

Read more