Tuesday, June 26, 2007

"Proxy Authentication Required" for .Net Apps

The A/C in our office is out for the second day so we are all working from home. It's been a good break and I haven't missed the drive.
I've been working through an issue in our test farm with our .Net application. The error being trickier by the addition of our new domain at work and our new machines. I recently got this error:

System.Net.WebException Message:
The request failed with HTTP status 407:
Proxy Authentication Required.

The problem was the .Net 2.0 application was not using the proxy exclusion list in my IE settings - for some reason. The problem was solved by the addition of this little wad of xml in the web.config:

<system.net>
<defaultProxy>
<proxy usesystemdefault="False"/>
</defaultProxy>
</system.net>

This forces .Net to not use a proxy by default, but to use a direct connection foregoing the need for authentication and making everything zippier.

4 comments:

Anonymous said...

hey thanks! this tip got my app working first try

Anonymous said...

Great stuff !!!...i installed some router software to get my broadband going and since then my visual stuido kep throwing this error when i run my web projects... Thanks to this tip its fixed. !!!! wooohooo...
funny thing is if i deployed the projects to a virtual server on iss, it would work...only when i F5 from my VS IDE it would throw this error... Many Thanks

Alex said...

thanks! saved me some grief.

Iain F said...

Thanks for the tip. Enter this in app.config also to force your app to skip the ie proxy setting.