473,396 Members | 2,140 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,396 software developers and data experts.

HTTP Classes

Hi All,
I am using .net classes to download files over HTTP. in the old world,
I would use WinInet, and the good think about that was that if the
client was behind a proxy, it would already use IE settings
automaticaly, and the communication would go smooth. in .NET, i have
to make the users enter proxy info (URL, port, sometimes password)

is there any way in .NET to have it use the exesting IE setup on a
local computer for web communication, just like with the old WinInet?

thanks

Feb 19 '07 #1
9 3389
<yo**@nobhillsoft.comwrote:
I am using .net classes to download files over HTTP. in the old world,
I would use WinInet, and the good think about that was that if the
client was behind a proxy, it would already use IE settings
automaticaly, and the communication would go smooth. in .NET, i have
to make the users enter proxy info (URL, port, sometimes password)

is there any way in .NET to have it use the exesting IE setup on a
local computer for web communication, just like with the old WinInet?
WebClient and HttpWebRequest use the same proxy as IE by default, IIRC.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 19 '07 #2
Hi Jon,
I dont think HttpWebRequest does. are you sure? Over here it sure
doesnt, at least not by default. check out this code sample, which is
one out of many given by Microsoft:

HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);

//handle proxy, if given
if (sProxy.Length>0)
{
WebProxy proxyObject;
if (iProxyPort==0)
proxyObject = new WebProxy(sProxy);
else
proxyObject = new WebProxy(sProxy, iProxyPort);
Request.Proxy = proxyObject;
}
see? my do i need to set proxy explicitly? i am 100% that if i wont
set those, my code wont work when i am behind a proxy. if i get the IE
settings and put them into those variables (sProxy, iProxyPort) than
lo and behold, it would work....

thanks


Feb 21 '07 #3
<yo**@nobhillsoft.comwrote:
I dont think HttpWebRequest does. are you sure? Over here it sure
doesnt, at least not by default. check out this code sample, which is
one out of many given by Microsoft:

HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);

//handle proxy, if given
if (sProxy.Length>0)
{
WebProxy proxyObject;
if (iProxyPort==0)
proxyObject = new WebProxy(sProxy);
else
proxyObject = new WebProxy(sProxy, iProxyPort);
Request.Proxy = proxyObject;
}
see? my do i need to set proxy explicitly? i am 100% that if i wont
set those, my code wont work when i am behind a proxy. if i get the IE
settings and put them into those variables (sProxy, iProxyPort) than
lo and behold, it would work....
Hmm... I was sure that it did on at least the Compact Framework, as we
had to work round that in a product I worked on ages ago.

In .NET 2.0, WebRequest.GetDefaultProxy() has been obsoleted, saying
that you should "use the proxy selected for you by default".

Are you using 1.1 or 2.0?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 22 '07 #4
Hey,
I am using .NET 2.0; so far, form what i read the method is not
needed... it does this by default... right? my understanding is that
it works only for nondynamic proxies. (right?) is there any way to
use IE settings, even when they are dynamic? thanks

Feb 25 '07 #5
Thus wrote yo**@nobhillsoft.com,
Hey,
I am using .NET 2.0; so far, form what i read the method is not
needed... it does this by default... right? my understanding is that
it works only for nondynamic proxies. (right?)
That was true for System.Net 1.x.
is there any way to
use IE settings, even when they are dynamic? thanks
That feature has been added in System.Net 2.0. Are you using a .pac file?

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Feb 26 '07 #6
is there any way to
use IE settings, even when they are dynamic? thanks

That feature has been added in System.Net 2.0. Are you using a .pac file?
I dont know what the customer is using. many download my utility, each
one has a different proxy settings. I am looking for the solution that
will work with whatever they have... static (thats easy, .net2.0 does
this by default) pac file, DHCP...

Mar 3 '07 #7
Thus wrote yo**@nobhillsoft.com,
>>is there any way to
use IE settings, even when they are dynamic? thanks
That feature has been added in System.Net 2.0. Are you using a .pac
file?
I dont know what the customer is using. many download my utility, each
one has a different proxy settings. I am looking for the solution that
will work with whatever they have... static (thats easy, .net2.0 does
this by default) pac file, DHCP...
Why not include an application specific proxy setting that users can apply
if autodetection seems to fail?

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Mar 3 '07 #8
Why not include an application specific proxy setting that users can apply
if autodetection seems to fail?

that is a good idea, and we do that. but most users haven't even heard
of proxy, and those who are and are not lazy cant even put the data
in... because its in some script file or something and IT wont give it
to them. You helped me a lot by pointing out the .net 2.0 has auto
detect automatically. now the last thing i need to know is: what does
auto detect detects? it does static proxy that's set up in IE', thats
good. what about dynamic ones? if its in a PAC file, will it detect
it? for example there are all those postings online on how to do API
calls to WinINet (mostly with function WinHttpGetProxyForUrl, but also
with others) who will help you with dynamic proxies - is that still
needed with .net 2.0, or is it built in to the .net now, and calls to
wininet would be superfluous?

Mar 4 '07 #9
Thus wrote yo**@nobhillsoft.com,
>Why not include an application specific proxy setting that users can
apply if autodetection seems to fail?
that is a good idea, and we do that. but most users haven't even heard
of proxy, and those who are and are not lazy cant even put the data
in... because its in some script file or something and IT wont give it
to them. You helped me a lot by pointing out the .net 2.0 has auto
detect automatically. now the last thing i need to know is: what does
auto detect detects? it does static proxy that's set up in IE', thats
good. what about dynamic ones? if its in a PAC file, will it detect
it?
Yes to .PAC.
for example there are all those postings online on how to do API
calls to WinINet (mostly with function WinHttpGetProxyForUrl, but also
with others) who will help you with dynamic proxies - is that still
needed with .net 2.0, or is it built in to the .net now, and calls to
wininet would be superfluous?
WinHttpGetProxyForUrl AFAIK implements WPAD as System.Net 2.0 does -- it
shouldn't be necessary to use that.

http://msdn.microsoft.com/msdnmag/is...n/default.aspx
explains the System.Net 2.0 implementation.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Mar 5 '07 #10

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

Similar topics

13
by: Wolfgang May | last post by:
Hi, I have a problem with the HTTP implementation of the PEAR package: I try to PUT an XML instance to an XML database (eXist), but it always puts a binary: <?php require_once...
4
by: isee | last post by:
I want to send xml to some site and get response (also XML). I am using vb.net,but I don't want to install MSXML 4.0 .
1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
9
by: Jack | last post by:
Hello I have a library of calculationally intensive classes that is used both by a GUI based authoring application and by a simpler non-interactive rendering application. Both of these...
4
by: john townsley | last post by:
do people prefer to design classes for the particular job or for a rangle of tasks they might encounter now and in the future. i am doing some simple win32 apps and picking classes is simple, but...
2
by: Indiana Epilepsy and Child Neurology | last post by:
Before asking this questions I've spent literally _years_ reading (Meyer, Stroustrup, Holub), googling, asking more general design questions, and just plain thinking about it. I am truly unable to...
18
by: Edward Diener | last post by:
Is the packing alignment of __nogc classes stored as part of the assembly ? I think it must as the compiler, when referencing the assembly, could not know how the original data is packed otherwise....
6
by: ivan.leben | last post by:
I want to write a Mesh class using half-edges. This class uses three other classes: Vertex, HalfEdge and Face. These classes should be linked properly in the process of building up the mesh by...
6
by: mailforpr | last post by:
Suppose you have a couple of helper classes that are used by 2 client classes only. How can I hide these helper classes from other programmers? Do you think this solution is a good idea?: class...
2
by: Amu | last post by:
i have a dll ( template class) ready which is written in VC++6. But presently i need to inherit its classes into my new C#.net project.so if there is some better solution with u then please give me...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.