473,403 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

webproxy settings for httpWebRequests

djc
I see many ways to accomplish setting up proxy settings for a web request in
the documentation but many of them are marked as obsolete.

1) What is the current and correct way to tell all my httpWebRequests within
a class to *not* use any proxy server?

I don't want to setup the proxy on each webRequest within my class on an
individual basis, and I don't want to rely on the bypassLocal setting, or
the host exclusion list since I don't find those settings to be reliable in
IE itself.

2) mind as well ask since its related and I will probably want to do this at
some point. What is the current and correct way to tell an individual
httpWebReqest to *not* use any proxy?

Jul 18 '06 #1
7 2999
djc,

By default, HttpWebRequest instances should be created without the Proxy
property being set. That is good enough.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"djc" <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>I see many ways to accomplish setting up proxy settings for a web request
in the documentation but many of them are marked as obsolete.

1) What is the current and correct way to tell all my httpWebRequests
within a class to *not* use any proxy server?

I don't want to setup the proxy on each webRequest within my class on an
individual basis, and I don't want to rely on the bypassLocal setting, or
the host exclusion list since I don't find those settings to be reliable
in IE itself.

2) mind as well ask since its related and I will probably want to do this
at some point. What is the current and correct way to tell an individual
httpWebReqest to *not* use any proxy?

Jul 18 '06 #2
djc
thanks for the reply Nicholas.

I am seeing a different behavior here. On my machine and another test
machine on the same network the httpWebRequest is using IE's proxy settings
by default. I have verified this with the following output right before
issuing the getResponse:
Console.WriteLine("current proxy is: {0}", myHTTPRequest.Proxy.GetProxy(new
Uri(_url)));

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:OO**************@TK2MSFTNGP03.phx.gbl...
djc,

By default, HttpWebRequest instances should be created without the
Proxy property being set. That is good enough.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"djc" <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>>I see many ways to accomplish setting up proxy settings for a web request
in the documentation but many of them are marked as obsolete.

1) What is the current and correct way to tell all my httpWebRequests
within a class to *not* use any proxy server?

I don't want to setup the proxy on each webRequest within my class on an
individual basis, and I don't want to rely on the bypassLocal setting, or
the host exclusion list since I don't find those settings to be reliable
in IE itself.

2) mind as well ask since its related and I will probably want to do this
at some point. What is the current and correct way to tell an individual
httpWebReqest to *not* use any proxy?


Jul 18 '06 #3
Ahh, it appears that by default, it returns the value from the static
Select method on the GlobalProxySelection class.

You can simply set the Proxy property to the value of the static
GetEmptyWebProxy method on the GlobalProxySelection class in order to
specify no proxy.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"djc" <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
thanks for the reply Nicholas.

I am seeing a different behavior here. On my machine and another test
machine on the same network the httpWebRequest is using IE's proxy
settings by default. I have verified this with the following output right
before issuing the getResponse:
Console.WriteLine("current proxy is: {0}",
myHTTPRequest.Proxy.GetProxy(new Uri(_url)));

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:OO**************@TK2MSFTNGP03.phx.gbl...
>djc,

By default, HttpWebRequest instances should be created without the
Proxy property being set. That is good enough.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"djc" <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>>>I see many ways to accomplish setting up proxy settings for a web request
in the documentation but many of them are marked as obsolete.

1) What is the current and correct way to tell all my httpWebRequests
within a class to *not* use any proxy server?

I don't want to setup the proxy on each webRequest within my class on an
individual basis, and I don't want to rely on the bypassLocal setting,
or the host exclusion list since I don't find those settings to be
reliable in IE itself.

2) mind as well ask since its related and I will probably want to do
this at some point. What is the current and correct way to tell an
individual httpWebReqest to *not* use any proxy?



Jul 18 '06 #4
djc
That is actually what prompted my post here because the GlobalProxySelection
class is marked obsolete in VS 2005 but there is no note as to what *should*
be used in it's place. I think I recall reading that you can create an
instance of the webProxy class without assigning a proxy address (keeping it
null) and assign that instance of the webProxy class to the
httpWebRequest.proxy property. Since the address is null it doesn't use the
proxy. I'm not sure though, and have not played with it. Even if that worked
I wanted to verify that it is what *should* be done. Again, VS documentation
stated that the GlobalProxySelection class is obsolete but did *not* state
what *should* be used. At least I didn't see it.

thanks again for the reply though. I do appreciate it.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:em**************@TK2MSFTNGP03.phx.gbl...
Ahh, it appears that by default, it returns the value from the static
Select method on the GlobalProxySelection class.

You can simply set the Proxy property to the value of the static
GetEmptyWebProxy method on the GlobalProxySelection class in order to
specify no proxy.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"djc" <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>thanks for the reply Nicholas.

I am seeing a different behavior here. On my machine and another test
machine on the same network the httpWebRequest is using IE's proxy
settings by default. I have verified this with the following output right
before issuing the getResponse:
Console.WriteLine("current proxy is: {0}",
myHTTPRequest.Proxy.GetProxy(new Uri(_url)));

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:OO**************@TK2MSFTNGP03.phx.gbl...
>>djc,

By default, HttpWebRequest instances should be created without the
Proxy property being set. That is good enough.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"djc" <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl.. .
I see many ways to accomplish setting up proxy settings for a web
request in the documentation but many of them are marked as obsolete.

1) What is the current and correct way to tell all my httpWebRequests
within a class to *not* use any proxy server?

I don't want to setup the proxy on each webRequest within my class on
an individual basis, and I don't want to rely on the bypassLocal
setting, or the host exclusion list since I don't find those settings
to be reliable in IE itself.

2) mind as well ask since its related and I will probably want to do
this at some point. What is the current and correct way to tell an
individual httpWebReqest to *not* use any proxy?





Jul 18 '06 #5
djc,
If you go ahead and use the obsolete code in your project and set a
breakpoint on it, I am sure the warning message will tell you what code to
use. I say this because I have seen it.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"djc" wrote:
That is actually what prompted my post here because the GlobalProxySelection
class is marked obsolete in VS 2005 but there is no note as to what *should*
be used in it's place. I think I recall reading that you can create an
instance of the webProxy class without assigning a proxy address (keeping it
null) and assign that instance of the webProxy class to the
httpWebRequest.proxy property. Since the address is null it doesn't use the
proxy. I'm not sure though, and have not played with it. Even if that worked
I wanted to verify that it is what *should* be done. Again, VS documentation
stated that the GlobalProxySelection class is obsolete but did *not* state
what *should* be used. At least I didn't see it.

thanks again for the reply though. I do appreciate it.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:em**************@TK2MSFTNGP03.phx.gbl...
Ahh, it appears that by default, it returns the value from the static
Select method on the GlobalProxySelection class.

You can simply set the Proxy property to the value of the static
GetEmptyWebProxy method on the GlobalProxySelection class in order to
specify no proxy.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"djc" <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
thanks for the reply Nicholas.

I am seeing a different behavior here. On my machine and another test
machine on the same network the httpWebRequest is using IE's proxy
settings by default. I have verified this with the following output right
before issuing the getResponse:
Console.WriteLine("current proxy is: {0}",
myHTTPRequest.Proxy.GetProxy(new Uri(_url)));

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:OO**************@TK2MSFTNGP03.phx.gbl...
djc,

By default, HttpWebRequest instances should be created without the
Proxy property being set. That is good enough.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"djc" <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
I see many ways to accomplish setting up proxy settings for a web
request in the documentation but many of them are marked as obsolete.

1) What is the current and correct way to tell all my httpWebRequests
within a class to *not* use any proxy server?

I don't want to setup the proxy on each webRequest within my class on
an individual basis, and I don't want to rely on the bypassLocal
setting, or the host exclusion list since I don't find those settings
to be reliable in IE itself.

2) mind as well ask since its related and I will probably want to do
this at some point. What is the current and correct way to tell an
individual httpWebReqest to *not* use any proxy?




Jul 18 '06 #6
djc
ok, will do. Thanks.

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:9C**********************************@microsof t.com...
djc,
If you go ahead and use the obsolete code in your project and set a
breakpoint on it, I am sure the warning message will tell you what code to
use. I say this because I have seen it.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"djc" wrote:
>That is actually what prompted my post here because the
GlobalProxySelection
class is marked obsolete in VS 2005 but there is no note as to what
*should*
be used in it's place. I think I recall reading that you can create an
instance of the webProxy class without assigning a proxy address (keeping
it
null) and assign that instance of the webProxy class to the
httpWebRequest.proxy property. Since the address is null it doesn't use
the
proxy. I'm not sure though, and have not played with it. Even if that
worked
I wanted to verify that it is what *should* be done. Again, VS
documentation
stated that the GlobalProxySelection class is obsolete but did *not*
state
what *should* be used. At least I didn't see it.

thanks again for the reply though. I do appreciate it.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in
message news:em**************@TK2MSFTNGP03.phx.gbl...
Ahh, it appears that by default, it returns the value from the
static
Select method on the GlobalProxySelection class.

You can simply set the Proxy property to the value of the static
GetEmptyWebProxy method on the GlobalProxySelection class in order to
specify no proxy.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"djc" <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
thanks for the reply Nicholas.

I am seeing a different behavior here. On my machine and another test
machine on the same network the httpWebRequest is using IE's proxy
settings by default. I have verified this with the following output
right
before issuing the getResponse:
Console.WriteLine("current proxy is: {0}",
myHTTPRequest.Proxy.GetProxy(new Uri(_url)));

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com>
wrote
in message news:OO**************@TK2MSFTNGP03.phx.gbl...
djc,

By default, HttpWebRequest instances should be created without the
Proxy property being set. That is good enough.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"djc" <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl.. .
I see many ways to accomplish setting up proxy settings for a web
request in the documentation but many of them are marked as obsolete.

1) What is the current and correct way to tell all my
httpWebRequests
within a class to *not* use any proxy server?

I don't want to setup the proxy on each webRequest within my class
on
an individual basis, and I don't want to rely on the bypassLocal
setting, or the host exclusion list since I don't find those
settings
to be reliable in IE itself.

2) mind as well ask since its related and I will probably want to do
this at some point. What is the current and correct way to tell an
individual httpWebReqest to *not* use any proxy?





Jul 18 '06 #7
djc
Error 1 Warning as Error: 'System.Net.GlobalProxySelection' is obsolete:
'This class has been deprecated. Please use WebRequest.DefaultWebProxy
instead to access and set the global default proxy. Use 'null' instead of
GetEmptyWebProxy.

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:9C**********************************@microsof t.com...
djc,
If you go ahead and use the obsolete code in your project and set a
breakpoint on it, I am sure the warning message will tell you what code to
use. I say this because I have seen it.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"djc" wrote:
>That is actually what prompted my post here because the
GlobalProxySelection
class is marked obsolete in VS 2005 but there is no note as to what
*should*
be used in it's place. I think I recall reading that you can create an
instance of the webProxy class without assigning a proxy address (keeping
it
null) and assign that instance of the webProxy class to the
httpWebRequest.proxy property. Since the address is null it doesn't use
the
proxy. I'm not sure though, and have not played with it. Even if that
worked
I wanted to verify that it is what *should* be done. Again, VS
documentation
stated that the GlobalProxySelection class is obsolete but did *not*
state
what *should* be used. At least I didn't see it.

thanks again for the reply though. I do appreciate it.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in
message news:em**************@TK2MSFTNGP03.phx.gbl...
Ahh, it appears that by default, it returns the value from the
static
Select method on the GlobalProxySelection class.

You can simply set the Proxy property to the value of the static
GetEmptyWebProxy method on the GlobalProxySelection class in order to
specify no proxy.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"djc" <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
thanks for the reply Nicholas.

I am seeing a different behavior here. On my machine and another test
machine on the same network the httpWebRequest is using IE's proxy
settings by default. I have verified this with the following output
right
before issuing the getResponse:
Console.WriteLine("current proxy is: {0}",
myHTTPRequest.Proxy.GetProxy(new Uri(_url)));

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com>
wrote
in message news:OO**************@TK2MSFTNGP03.phx.gbl...
djc,

By default, HttpWebRequest instances should be created without the
Proxy property being set. That is good enough.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"djc" <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl.. .
I see many ways to accomplish setting up proxy settings for a web
request in the documentation but many of them are marked as obsolete.

1) What is the current and correct way to tell all my
httpWebRequests
within a class to *not* use any proxy server?

I don't want to setup the proxy on each webRequest within my class
on
an individual basis, and I don't want to rely on the bypassLocal
setting, or the host exclusion list since I don't find those
settings
to be reliable in IE itself.

2) mind as well ask since its related and I will probably want to do
this at some point. What is the current and correct way to tell an
individual httpWebReqest to *not* use any proxy?





Jul 18 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jamie Laundon | last post by:
Hi, WebProxy.GetDefaultProxy() has been deprecated in .NET 2.0, what is the preferred new method of retrieving IE Proxy settings? Thanks, Jamie
1
by: Jim Douglas | last post by:
I have a requirement to dynamically create a webProxy object in C#. I have created an instance of the webProxy and stored it within a hashtable then placing the hashtable in cache. When required I...
4
by: vooose | last post by:
Consider accessing a webpage through a proxy server: WebRequest request = WebRequest.Create("http://somepage.com"); WebProxy proxy = new WebProxy(proxyHost, proxyPort); proxy.Credentials = new...
2
by: Sam Santiago | last post by:
I am using the WebProxy.GetDefaultProxy() function to read the IE settings, but it's returning an empty WebProxy object. Are there any known reasons why this is not reading the proxy settings in IE...
0
by: Michael S. Scherotter | last post by:
I am building a C# desktop application in .Net 1.1 that consumes web services. I use System.Net.WebProxy.GetDefaultProxy() to get the proxy settings from IE but I get reports from people who are...
4
by: Andrew | last post by:
Morning everybody, I have an XML document located on a web address and I wish to create a C# program to read that XML document and process it - which shouldn't be that difficult yet I'm running...
3
by: John A Grandy | last post by:
I am always RAS'd into MS CorpNet VPN under my REDMOND account. I am always able to ping "itgproxy.redmond.corp.microsoft.com" I instantiate a System.Net.WebProxy object as follows: using...
0
by: Armin Prosch | last post by:
Hi, we call a web service in an intranet environment. The target host is bypassed as of the IE setting. We retrieve the system proxy settings through "myService.Proxy =...
3
by: =?Utf-8?B?TXJOb2JvZHk=?= | last post by:
I found an example online and when I tried repeating it with the proxy I normally use for my browser, I get errors. What I do is this: WebProxy proxy = new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.