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,551
  • 11
  • 67
  • 97

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,584
  • 6
  • 69
  • 80