Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Obtaining outbound ip address
Message
De
05/07/2007 10:43:40
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
04/05/2007 02:56:55
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
ASP.NET
Divers
Thread ID:
01222271
Message ID:
01237945
Vues:
16
Walter,
I created a page and put it on the external web server. I am using the UserHostAddress method.

However, I am getting a different IP address than whatismyip.org gives. I know the whatismyip.org address is the one I want, and I can't figure out what is going on.

>If you have control over that external web server...
>
>getip.aspx:
>
>< %@ Page language="c#"  % >< %
>    Response.ContentType = "text/plain";
>    Response.Write( Request.UserHostAddress.ToString() );
>% >
>
>
>getip.cs (command line example program)
>
>using System;
>using System.IO;
>using System.Net;
>
>public class GetIpApp
>{
>	static void Main()
>	{
>		WebClient client = new WebClient();
>		
>		try {
>			string strMyIp = client.DownloadString( "http://localhost/getip.aspx" );
>			Console.WriteLine( "IP Address is: {0}", strMyIp );
>		}
>		catch( Exception ex ) { Console.WriteLine( ex.ToString() ); }
>	}
>}
>
>
>If you were to try this on your own PC (as I've written) you'd get 127.0.0.1 as the IP address but on a remote server the firewall's IP would come back.
>
>If you don't have the ability to put a page of some sorts on the remote server, you're stuck. There is no way your client PC can get this information, short of doing a traceroute and guessing.
Very fitting: http://xkcd.com/386/
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform