Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC Request ServerVariables

Tags:

c#

asp.net-mvc

I am using ASP.NET MVC, and need to obtain and log Request Information.

I'm looking at Microsoft​.AspNetCore​.Http.HttpRequest and do not see ServerVariables. Has this been removed?

Is there a way I can get to the same data as I could via System.Web.HttpRequest.ServerVariables?

Thanks!

Philip

like image 984
Philip Tenn Avatar asked Jun 07 '26 17:06

Philip Tenn


1 Answers

Microsoft​.AspNetCore​.Http.HttpRequest is as the namespace says part of asp.net core. The ServerVariables is a collection of variables provided by IIS. As asp.net core does not depend on IIS this property doesn't exist anymore.


If do not use asp.net core this is the HttpRequest class to use.

like image 115
NtFreX Avatar answered Jun 09 '26 07:06

NtFreX



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!