Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 812
Spafa9 Avatar asked Feb 04 '26 11:02

Spafa9


1 Answers

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

like image 159
Ulas Avatar answered Feb 06 '26 05:02

Ulas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!