|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
The remote server returned an error: (407) Proxy Authentication Rehas been working up until now: System.Net.WebRequest request; System.Net.WebResponse response; request = System.Net.FileWebRequest.Create( "http://store.bearvalley.com/live/camimage_00001.jpg"); response = request.GetResponse(); When it tries to execute the request.GetResponse() call I get the following exception: The remote server returned an error: (407) Proxy Authentication Required. I can paste the uri into my browser and it works OK. Any assistance would be greatly appreciated. Thanks! ;^) Richard Richard,
You might want to change the code that calls the static Create method to call off the WebRequest class. It won't fix your problem, but it makes the code a little more accurate (considering that you are getting an HttpWebRequest based on the URL). The reason it works for you in your browser is because your browser is set up correctly to use a proxy. You have to do the same thing in code, creating an instance of the WebProxy class, setting the properties on it, and then setting the Proxy property to that WebProxy instance. -- Show quote- Nicholas Paldino [.NET/C# MVP] - mvp@spam.guard.caspershouse.com <Richard@nospam.nospam> wrote in message news:F8E09733-85ED-48DB-8EF6-B521DFA49035@microsoft.com... > My webcam app runs OK on XP but not on Vista. Here's my code snippet that > has been working up until now: > > System.Net.WebRequest request; > System.Net.WebResponse response; > request = System.Net.FileWebRequest.Create( > "http://store.bearvalley.com/live/camimage_00001.jpg"); > response = request.GetResponse(); > > When it tries to execute the request.GetResponse() call I get the > following > exception: > The remote server returned an error: (407) Proxy Authentication Required. > > I can paste the uri into my browser and it works OK. > > Any assistance would be greatly appreciated. > > Thanks! ;^) > > Richard Thanks Nicholas!
First I can't create an instance of WebRequest because the compiler gives an error saying it's an abstract class - I don't know what that means but it looks like I have to use the static Create method. So here's what I tried based on your suggestion: System.Net.WebRequest request; System.Net.WebResponse response; IWebProxy iwp = System.Net.WebRequest.GetSystemWebProxy(); request = System.Net.WebRequest.Create( "http://store.bearvalley.com/live/camimage_00001.jpg"); request.Proxy = iwp; response = request.GetResponse(); When I hover Proxy in the debugger I can see my proxy server address but I'm still getting the error when it executes the GetResponse call. Any more suggestions would be appreciated. Thanks! ;^) Richard Show quote "Nicholas Paldino [.NET/C# MVP]" wrote: > Richard, > > You might want to change the code that calls the static Create method to > call off the WebRequest class. It won't fix your problem, but it makes the > code a little more accurate (considering that you are getting an > HttpWebRequest based on the URL). > > The reason it works for you in your browser is because your browser is > set up correctly to use a proxy. You have to do the same thing in code, > creating an instance of the WebProxy class, setting the properties on it, > and then setting the Proxy property to that WebProxy instance. > > > -- > - Nicholas Paldino [.NET/C# MVP] > - mvp@spam.guard.caspershouse.com > > <Richard@nospam.nospam> wrote in message > news:F8E09733-85ED-48DB-8EF6-B521DFA49035@microsoft.com... > > My webcam app runs OK on XP but not on Vista. Here's my code snippet that > > has been working up until now: > > > > System.Net.WebRequest request; > > System.Net.WebResponse response; > > request = System.Net.FileWebRequest.Create( > > "http://store.bearvalley.com/live/camimage_00001.jpg"); > > response = request.GetResponse(); > > > > When it tries to execute the request.GetResponse() call I get the > > following > > exception: > > The remote server returned an error: (407) Proxy Authentication Required. > > > > I can paste the uri into my browser and it works OK. > > > > Any assistance would be greatly appreciated. > > > > Thanks! ;^) > > > > Richard > |
|||||||||||||||||||||||