In the realm of C# and ASP.NET development, extension methods serve as invaluable tools, empowering developers to enhance the expressiveness and efficiency of their code. In this blog post, we will delve into some of the basic extension methods that any ASP.Net Core project needs and can elevate your web development projects.
public static string GetBasePath(this HttpContext httpContext)
{
return $"{httpContext.Request.Scheme}://{httpContext.Request.Host}";
}