What is the .net core version of HttpContext.Current.Request.ServerVariables["HTTP_HOST"]

3.8k Views Asked by At

I am trying to rewrite this line of code HttpContext.Current.Request.ServerVariables["HTTP_HOST"] it cant find current it doesn't contain a definition.

1

There are 1 best solutions below

0
On

There is an extension in .net core. To use it you need to install prerequested package which denoted below.

https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.httpcontextservervariableextensions.getservervariable?view=aspnetcore-5.0