2

I am working on a project to download files using .Net c# 2.0 SP1. One of the requirements of the project is to not seek any proxy details and automatically detect this from IE etc.

Now i haven't worked with proxy before and hence i am a bit baffled. After hours of searching google, msdn etc, i have come across the following article http://msdn.microsoft.com/en-gb/magazine/cc300743.aspx#S3

Now i am totally confused how to do this? Can someone please help me with an easier implementation or guide me please?

Sorry once again if i sound silly, but i haven't worked with .Net proxies and hence I am struggling.

This is for C# Winforms and hence i cannot do this in web.config.

Thanks in advance for your help.

1 Answer 1

1

.NET 2.0 will automatically using the proxy settings from IE by default; however, there is an extra configuration step required to use the default proxy credentials saved in IE. To enable this, ensure that the following section appears in your app.config file:

<configuration>
    <!-- ... -->
    <system.net>
        <defaultProxy useDefaultCredentials="true"/>
    </system.net>

For a full description of the element, see MSDN. For more complicated HTTP Proxy scenarios, see Using HTTP Proxy Servers.

Sign up to request clarification or add additional context in comments.

3 Comments

I should have mentioned this that i need to do this for winforms.
I am looking for some C# code possible similar to C code here stackoverflow.com/questions/202547/…
@Manish haven't tested it yet but maybe this might help: "pac file should have proper content type (Content-type: application/x-ns-proxy-autoconfig)", more Using Proxy Automatic Configuration from IE Settings in .Net.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.