Portforwading to ssh server and make http request

Jun 23, 2014 at 2:56 AM
Edited Jun 23, 2014 at 3:12 AM
Hello all,
I wanna connect to ssh server and send a http request which isn't permitted by my ip. How I can do it? This is my code but the result is not correct about my ip after forwarding port.
Thank so much.

public static void Main()
    {
        string remoteHost = "173.246.25.188";
        ConnectionInfo connectionInfo = new PasswordConnectionInfo(remoteHost, 22, "username", "password");
        SshClient client;
        //ForwardedPortLocal port;
        string boundHost = "127.0.0.1";
        uint boundPort = 8011;
        uint remotePort = 22;
        using(client = new SshClient(connectionInfo)){
            client.Connect();                
            ForwardedPortLocal port = new ForwardedPortLocal(boundHost, boundPort, remoteHost, remotePort);
            client.AddForwardedPort(port);
            port.Start();
            sendRequest();                
        }
    }

    public static void sendRequest()
    {   
        string url = "http://cmyip.com/";
        WebResponse response = null;
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        request.Method = "GET";
        request.ContentType = "application/json";
        request.UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0";
        request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";           
        request.KeepAlive = false;
        request.ContentLength = 0;           
        request.Timeout = 15000;

        response = request.GetResponse();            
        Stream stream = response.GetResponseStream();
        StreamReader reader = new StreamReader(stream, Encoding.UTF8);
        String responseString = reader.ReadToEnd();
        Console.WriteLine(responseString);
        Console.ReadKey();
    }