Get the client IP not the proxy's

S

Stephane

Hi,

Is there a way to get the client IP from a web service? I keep receiving the
server's IP address.

From my web method, I tried all of this:

Context.Request.UserHostAddress;
Context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
Context.Request.ServerVariables["REMOTE_ADDR"];

Even by checking the headers, there's no client IP:

NameValueCollection NVCSrvElements = Context.Request.ServerVariables;
foreach(string item in NVCSrvElements.Keys)
{
Response.Write(item + " " + NVCSrvElements[item]);
}

Any idea?

Thanks,

Stephane
 
J

John Saunders

Stephane said:
Hi,

Is there a way to get the client IP from a web service? I keep receiving
the
server's IP address.

From my web method, I tried all of this:

Context.Request.UserHostAddress;
Context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
Context.Request.ServerVariables["REMOTE_ADDR"];

Even by checking the headers, there's no client IP:

NameValueCollection NVCSrvElements = Context.Request.ServerVariables;
foreach(string item in NVCSrvElements.Keys)
{
Response.Write(item + " " + NVCSrvElements[item]);
}

Any idea?

Yes. Sorry, it can't be done.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top