Spafa9
Spafa9

Reputation: 762

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

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.

Upvotes: 3

Views: 4408

Answers (1)

Ulas
Ulas

Reputation: 19

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

Upvotes: 1

Related Questions