I created the ASMX service and in the code that processes the error log that comes from ELMAH. I add all the fields to the database and add a few more, one is the IP address of the requested client ...
But I canβt (please read, I donβt know how) to get this ...
I'm used to
string ipAddress = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (ipAddress == "") ipAddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
But of course, this does not apply here, because it is not an HTML request, but a SOAP request
in the ALL_HTTP header I get all this information:
HTTP_CONNECTION:Keep-Alive
HTTP_CONTENT_LENGTH:440331
HTTP_CONTENT_TYPE:text/xml; charset=utf-8
HTTP_EXPECT:100-continue
HTTP_HOST:www.mydomainname.com
HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.3074)
HTTP_VSDEBUGGERCAUSALITYDATA:uIDPowJ7s0UYlmhEqcDjxYQT/TQAAAAADlaOOkJ5DUizA7gKLg3YEPur8pFWlaVFmpinSAOBTuIACQAA
HTTP_SOAPACTION:"http://www. mydomainname.com/webservices/ErrorReportService/ReportErrors"
Where and how can I get the requested IP?
Please note that I do not use any authentication (yet) ... :)
source
share