Fix it so that .NET apps can access HTTP thru authenticating proxy server by default
If you run a .NET app that needs to talk to the web, and you're behind an authenticating proxy server, then that app will fail to talk to the web.
Internet Explorer and Google Chrome work, Visual Studio and loads of other Microsoft apps will work. They can all talk to the web. But every .NET-based app or website I've ever seen will fail.
The implications of this are profound. I've seen umpteen forum posts over the years where people are scratching their heads, wondering what's wrong. I've seen IT guys re-route their users thru special-case connections to the web, because the user has to access some web functionality.
I've installed a piece of software that needs to authenticate a license key over the web... only to fail. And then you have to call their support lines.
I've seen Umbraco and Orchard CMS users fail to access the online galleries of themes and widgets. No-one - developers, users, IT guys - have a clue what's wrong or how to fix it.
Even Microsoft's .NET apps fail: if I try to run WCF's svcutil.exe on a remote service, it will fail... because I'm behind an authenticating proxy server.
And yet the fix is so simple. Simple, but no-one knows about it... no-one! Take a look at this StackOverflow question:-
The simple, simple fix is to add this to your .NET app's app/web config file:-
<system.net>
<defaultProxy useDefaultCredentials="true" />
</system.net>
But since no-one knows about this, let's end the years of confusion and have .NET 4.5 change the default value of useDefaultCredentials from false to true. Problem solved, and everyone can get on with their lives.
If Internet Explorer "just works", why can't .NET-build apps "just work"?
And for a better-argued case, see here:-
http://sticklebackplastic.com/post/2007/01/26/Poxy-proxies.aspx
Thank you.
10 comments
-
Bruce
commented
Which better? Using proxy website like ninja proxy http://www.ninjaproxy.eu or proxy server to hide ip?
-
Thomas Levesque
commented
@Pedro, I think it only works if the proxy uses NTLM authentication. I have a Squid proxy with basic authentication, and it doesn't work either.
-
Pedro
commented
It doesn`t work. Although I put in my app.config this sentence:
<system.net>
<defaultProxy useDefaultCredentials="true" />
</system.net>Still I'm getting this error in my .Net pgm :
HTTP status 407: Proxy Authentication Required. -
Bryan Melo
commented
I need some help, i'm currently facing the same problem I can go on firefox and surf the web, but i can't use any of the programs that access the internet. This is one of the errors i get when trying to play Dayz. tinypic.com/r/10rsevs/6
-
Anonymous
commented
Gracias por el aporte, solucione el problema.
-
Alexsandro Pereira commented
news about that solution?
-
drweb86
commented
i wish proxy is gone from .net and nobody should take care of that in their apps reinventing the wheel
-
Andrew Webb
commented
Thanks jjthebig1. Not sure if the message is getting through though.
What scares me is how helpless people are when a proxy auth problem occurs: developers, IT guys, end users. Often the failure is hidden by a cryptic error page that only says that "something" went wrong.
People scratch their heads for days, post on forums and receive replies that don't help. In my firm I found out that IT had re-routed a guy using Umbraco - re-routed him around our proxy - just so he could access the online galleries. This took effort! I simply edited the Umbraco web.config file, added the magic config and - hey presto - no need for any complicated re-routing.
Even with Microsoft apps that talk to the web, I routinely have to edit their app.config files just to get past our proxy server.
I've got loads of other examples where I've seen this issue waste a huge amount of peoples' time - e.g. triggering emails and phone calls to internal IT or an application's vendor's Support.
Not sure how this User Voice thing works. Do Microsoft only take notice if an issue gets a huge number of votes?
Well, at least my XML snippet is now showing up in the original post... when I first posted it wasn't displayed at all.
-
jjthebig1 commented
Andrew, you're a saint.
-
Andrew Webb
commented
Oops... your input editor didn't like my XML snippet. Let's see if I can escape it better. Here goes:-
<system.net>
<defaultProxy useDefaultCredentials="true" />
</system.net>