Tag Archives: Credentials

What is it with Devs and Firewalls?

I’ve only found one Twitter client that works properly from behind an Internet proxy. What is it with Devs today? Do they not know that there is a large population out on the Internet that would love to use their programs at work? And that most corporations do not allow direct access to the Internet?


So that every .NET Dev out there will know how to incorporate Internet proxy authentication into their code, I thought I would post the following simple steps:


1. Add 4 settings to your App.Config file:


UseProxy – Boolean, turns on and off the proxy code

ProxyUri – String, the URL to the proxy server formatted as http://proxyserver:port

ProxyUsername – String, the User Name to use to authenticate with the proxy server

ProxyPassword – String, the Password to use to authenticate with the proxy server


2. Add the following code to your Get or Post code to create a WebProxy and add it to the WebClient:


if (Properties.Settings.Default.UseProxy)
    WebProxy proxy = new WebProxy(Properties.Settings.Default.ProxyUri);
    proxy.Credentials = new NetworkCredential(Properties.Settings.Default.ProxyUsername,
    client.Proxy = proxy;


That’s all there is to it! Not hard, pretty simple really, if you think about it. So with four application settings and no more than 7 lines of code, your too can incorporate Internet proxy authentication into your web-based Windows Form or WPF application.



So Why Doesn't Anyone Provide HTTP Proxy Support?

So, I want to follow Twitter at work on my desktop, however there is a proxy between me and the Twitter servers and all of the Twitter clients I find blow chunks when I try to connect. Am I one of the few users in the world behind a proxy? This can’t be! I know there have to be a lot of people in the same situation.


Its not only Twitter clients that I run into that do not support proxies, I’m finding it to be the norm not the exception. We’re not talking about anything big, all a developer needs to do is provide the option and provide the proxy credentials prior to making the call.