Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
So I was playing around with HttpWebRequest & HttpWebResponse trying to make a few connections with different proxies.
And I stumbled on to a weird issue.
I tried making a HttpWebRequest to http://cmyip.org with the Proxy "45.55.27.246:8080" and it went just fine, I looked through the WebResponse and it showed the Html document of http://cmyip.org as expected right?

Then I tried doing the exact same thing with this proxy
"192.99.46.182:1935"
This is where it gets weird, it seems as if it redirected me to some other webpage because the WebResponse was entierly different. It was some Wowza bla bla.. stuff. So I tried pasting in the ip and the port into my webbrowser and it was a white page with some text on it.
What caused this issue and how do I prevent stuff like this from happening?


private static void GetResponse()
        {

            WebProxy myProxy = default(WebProxy);
            try
            {
                myProxy = new WebProxy("45.55.27.246:8080");
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://cmyip.org");
                request.UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36";
                request.Timeout = 3000;
                request.Proxy = myProxy;
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                using (StreamReader sr = new StreamReader(response.GetResponseStream()))
                {
                    Console.WriteLine(sr.ReadToEnd());
                }
                Debug.Print(response.ResponseUri.ToString());
            }
            catch (Exception)
            {
                
            }
            Console.ReadLine();
        }


What I have tried:

I've tried looking around for what type of IP this is but couldnt find anything
Posted
Comments
Jochen Arndt 18-Dec-17 7:09am    
Are you shure that a proxy is listening on that IP and port?

If yes, you have to ask the provider of the service why you got a wrong answer.
aleksvarga 18-Dec-17 7:10am    
It's just a random proxy from the internet.
Would you happen to know what protocol it uses? HTTP/HTTPS right?
Jochen Arndt 18-Dec-17 7:18am    
Maybe the resource from where you get it is not up-to-date anymore.
Richard Deeming 18-Dec-17 13:27pm    
As Jochen said here, and as Rusty said on your StackOverflow post[^], a random IP address and port is not going to work as a proxy server.

The response you're getting from 192.99.46.182 indicates that this is not set up as a proxy server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900