Get the client IP not the proxy's

Discussion in 'ASP .Net Web Services' started by Stephane, Nov 9, 2006.

  1. Stephane

    Stephane Guest

    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
    Stephane, Nov 9, 2006
    #1
    1. Advertising

  2. "Stephane" <> wrote in message
    news:...
    > 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
    John Saunders, Nov 10, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vidy5300
    Replies:
    0
    Views:
    862
    vidy5300
    Jun 7, 2004
  2. Replies:
    0
    Views:
    1,640
  3. Karsten Wutzke
    Replies:
    1
    Views:
    876
    Steven Simpson
    Aug 20, 2007
  4. Klein Stéphane
    Replies:
    3
    Views:
    591
    Steve Holden
    Dec 20, 2009
  5. A.M-SG
    Replies:
    2
    Views:
    390
    Steven Cheng[MSFT]
    Nov 2, 2005
Loading...

Share This Page