In this article, we will discuss what HttpContext is and how to use it in a controller, plus how to register and use it in service.

Today we are going to learn about HttpContext in .NET Core. This article covers the following topics:

  • What is HttpContext?
  • How to access HttpContext in controller?
  • How to access HttpContext in service?
  • Conclusion

What is HttpContext?

It holds the current information about the Http request. It contains the information like authorization, authentication, request, response, session, items, users, formOptions, etc. Every HTTP request creates a new object of HttpContext with current information.

#aspdotnet #aspdotnet core #httpcontext

How to Get HttpContext ASP.NET Core
1.45 GEEK