Re: WebProxy with System.Net.WebClient
From: Joerg Jooss (news-reply_at_joergjooss.de)
Date: 09/24/05
- Previous message: Jéjé: "forms authentication + AzMan in ASP.Net 2..."
- Next in thread: Joerg Jooss: "Re: WebProxy with System.Net.WebClient"
- Reply: Joerg Jooss: "Re: WebProxy with System.Net.WebClient"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sat, 24 Sep 2005 09:36:43 -0700
Shahid wrote:
> hi,
>
> i m trying to get html from a website using asp.net. i wrote
> following code to access html of a website. it works fine but
> whenever i try this code from network (behind proxy server) , it
> gives me error " The underlying connection was closed: Unable to
> connect to the remote server". i don't know how to implement proxy
> class with in WebClient Class.
Prior to .NET 2.0, WebClient does not expose a Proxy property like
HttpWebRequest does.
There's one work-around you might want to try: Before creating your
WebClient, create a WebProxy instance for your specific proxy server
and set it as default by calling GlobalProxySelection.Select =
yourProxy;
If that doesn't work, you have to use HttpWebRequest instead.
Cheers,
-- http://www.joergjooss.de mailto:news-reply@joergjooss.de
- Previous message: Jéjé: "forms authentication + AzMan in ASP.Net 2..."
- Next in thread: Joerg Jooss: "Re: WebProxy with System.Net.WebClient"
- Reply: Joerg Jooss: "Re: WebProxy with System.Net.WebClient"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|