4

I'm trying to get the data that was in Request.ServerVariables["REMOTE_ADDR"] in an API controller in ASP.Net Web Api. But the servervariables dictionary is gone. Is that property/data still available?

Irwin
  • 12,181
  • 11
  • 66
  • 95

1 Answers1

2

Request.ServerVariables is there or not on the hosting medium that you have. Simply use Request.Properties["MS_HttpContext"].Request.ServerVariables["REMOTE_ADDR"] to get what you need.

Teoman Soygul
  • 25,324
  • 6
  • 68
  • 79