Re: The remote server returned an error: (407) Proxy Authenticatio



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

"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@xxxxxxxxxxxxxxxxxxxxxxxxxxx

<Richard@xxxxxxxxxxxxx> wrote in message
news:F8E09733-85ED-48DB-8EF6-B521DFA49035@xxxxxxxxxxxxxxxx
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

.



Relevant Pages

  • Re: Need help with creating a web forwarding site.
    ... Yep, I was thinking about the full HTTP response (including headers, HTML code ... In this script, yes - but thinking about it again, I guess you would need to ... What you're writing is more or less a proxy: ... Let's say the second request looks like this (just speculating - I'm too lazy ...
    (perl.beginners)
  • Re: Looking for a specific HTTP Header
    ... > The response to that request should be data from a different document ... > the server. ... you want to proxy a page changing his ...
    (comp.os.linux.networking)
  • Re: Hiding IP address while sending webrequest.
    ... whose ip address is changing dynamically so that ip address of proxy ... proxy will send to web server if i send request through proxy, ... Turn off your PC after sending the request. ... How is the server going to return you the response if it doesn't know ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Using webrequest without sending Ip address.
    ... If you don't send your IP address, how will the server know where to ... I want to send request using webrequest class. ... any information like my Pc name or my pc's ip address or the proxy ...
    (microsoft.public.dotnet.languages.csharp)
  • [Full-disclosure] Evading URL Filtering(websense) software configured in Transparent (or Sniffing) m
    ... Evading URL Filtering software configured in Transparent mode, ... but Websense has been informed in December ... They also had a copy of this proxy script for over ... Websense looks at this request and answers yes or no ...
    (Full-Disclosure)