views:

92

answers:

0

Hi @ll,

since yersterday i play a little bit with the .Net WebProxy Class, because i think the usage of webproxys in one of the big traps in the development of applications with web access (my java experience).

So i made a test case:

i used a squid proxy without proxy authentication and defined the proxy settings in my "ms internet explorer" because a friend told my that the .net framework take the proxy setting from the internet explorer (a big .net framework feature i thought). my c# test application tried to download google and yes it works.

Testcase-Source:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.google.com");
WebResponse Response = request.GetResponse();

Stream WebStream = Response.GetResponseStream();
StreamReader Reader = new StreamReader(WebStream);
string PageContent = Reader.ReadToEnd();

Console.WriteLine(PageContent);

Reader.Close();
WebStream.Close();
Response.Close();

Ok i tried the next step - i used a squid proxy with authentication. I entered only the proxy-ip and port to the internet explorer and not the credentials. Then i start my application again and holly sh*t - it works too... but how can it be - i thought. The solution the .net framework used the old proxys settings - the proxy without authentication.

So my first question is how can it be? How does the .net frameworks knows which proxy it can use? And the next quest is - can i used the "ms internet explorer"-proxy settings (with authentication) for my application?

Thanks for your answers, Kangee

P.S.: I am from germany - i hope my english is good enough to understand my question :-)