Re: How to fetch the default HTTP proxy
From: Bob Altman (rda_at_nospam.com)
Date: 06/16/04
- Next message: Supra: "Re: Socket.Available not right?"
- Previous message: Markus: "How to refresh IDE after changing property value?"
- In reply to: feroze: "Re: How to fetch the default HTTP proxy"
- Next in thread: Peter Huang: "Re: How to fetch the default HTTP proxy"
- Reply: Peter Huang: "Re: How to fetch the default HTTP proxy"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 16 Jun 2004 11:23:36 -0700
Sorry, I'm missing something really fundamental here...
I apparently don't need to do authentication. (The authentication stuff in
my original example was just copied-and-pasted from the example in the MSDN
docs.) If I remove all references to Credentials, my code still works as
before. As near as I can tell, the minimum code that I need to access a
website in code is:
' These two lines are necessary to get through the firewall
Dim proxy As New WebProxy("<My proxy name:8080>")
GlobalProxySelection.Select = proxy
Dim url As String = "<desired website>"
Dim wr As HttpWebRequest = DirectCast(WebRequest.Create(url),
HttpWebRequest)
dim response as HttpWebResponse = DirectCast(wr.GetResponse(),
HttpWebResponse)
I just don't want to hard-code my proxy address in my code. But if I remove
the first two code lines, the call to GetResponse fails.
As another attempt to get this to work, I created an app.config file and put
the following into it:
<?xml version="1.0" encoding="utf-8" ?><configuration>
<configuration>
<system.net>
<defaultProxy>
<proxy usesystemdefault="true" />
</defaultProxy>
</system.net>
</configuration>
Then I removed the GlobalProxySelection stuff and tried it. Still doesn't
work.
- Next message: Supra: "Re: Socket.Available not right?"
- Previous message: Markus: "How to refresh IDE after changing property value?"
- In reply to: feroze: "Re: How to fetch the default HTTP proxy"
- Next in thread: Peter Huang: "Re: How to fetch the default HTTP proxy"
- Reply: Peter Huang: "Re: How to fetch the default HTTP proxy"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|