Accessing the HttpContext outside the outside the HttpRequest

This page summarizes the projects mentioned and recommended in the original post on /r/dotnet

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • AspNetCore.Docs

    Documentation for ASP.NET Core

  • I am coming from .Net Framework and supporting the legacy apps to .Net Core ecosystem fairly recently, so I might have missed couple of release notes so please bear with me. In the .Net Framework usage of HttpContext outside HttpRequest was discouraged because it isn't thread safe. Now I get this feedback and then I google around a bit and I find topics like this: https://github.com/dotnet/AspNetCore.Docs/issues/18419 or like this onehttps://learn.microsoft.com/en-us/answers/questions/1143595/asp-net-core-web-api-how-to-use-user-claims-in-ser

  • ASP.NET Core

    ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.

  • the guy answering on learn.ms.com uses the same approach in principle (via the IHttpContextAccessor) but in a way that introduces coupling between the business service and the asp.net framework

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • CleanArchitecture

    Clean Architecture Solution Template for ASP.NET Core

  • As others have pointed out, you can use the IHttpContextAccessor. You can see an example implementation in Jason Taylor's Clean Architecture template here: https://github.com/jasontaylordev/CleanArchitecture/blob/main/src/WebUI/Services/CurrentUserService.cs

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • When/why do we need to use UseActifileExceptionHandler()?

    2 projects | /r/dotnet | 10 Feb 2023
  • .NET 7: Microsoft Reveals New ASP.NET Core Features

    2 projects | dev.to | 29 Aug 2022
  • Middleware in .NET 8

    1 project | dev.to | 18 Apr 2024
  • .NET Monthly Roundup - March 2024 - .NET 9 Preview 2, Smart Components, AI fun, and more!

    2 projects | dev.to | 9 Apr 2024
  • Bug Thread

    1 project | news.ycombinator.com | 16 Jan 2024