Home > DeveloperSection > Forums > Setting the IP of connection C#
Tanuj Kumar

Total Post:134

Posted on    December-09-2013 11:40 PM

 C# C# 

 1 Reply(s)
 1416  View(s)
Rate this:
I have a web browser in my application and I want to change the IP of the incoming connection that's about to load the page. How would I set the connection's IP address? I've done it before in Java but I have no idea on how to do it in C#.

ezra heywood
ezra heywood

Total Post:145

Posted on    December-10-2013 12:04 AM

Hi Tanuj,

If you want to set the proxy address, you can do it on the WebRequest:

using System;

using System.IO;

using System.Net;

class Program


    static void Main(string[] args)


        WebRequest wr = WebRequest.Create("http://www.google.com");

        WebProxy proxy = new WebProxy("http://localhost:8888");

        wr.Proxy = proxy;

        StreamReader sr = new StreamReader(wr.GetResponse().GetResponseStream());





Don't want to miss updates? Please click the below button!

Follow MindStick