Tim Huffam

Dotting the I and crossing the T of I.T.

  Home  |   Contact  |   Syndication    |   Login
  129 Posts | 0 Stories | 874 Comments | 677 Trackbacks

News

Archives

Post Categories

Interesting Blogs/Links

The following error occured when trying to open a web page (ASP.NET) that was doing an HttpRequest.

"The underlying connection was closed: The remote name could not be resolved."

This is usually caused because the ASP.NET app is on a network that is using a proxy server - and as ASP.NET does not run as a user account, it does not have access to the proxy settings in the registry.

To resolve add the following section to your web.config file.

<defaultProxy>
     <proxy
          usesystemdefault = "false"
          proxyaddress="http://proxyserver:port"
          bypassonlocal="true"
     />
</defaultProxy>

Note that this must be placed within a <system.net> section (not system.web!).

MS have a kb article on it here.

HTH

Tim

posted on Thursday, February 09, 2006 9:20 AM

Feedback

# re: Error: The underlying connection was closed: The remote name could not be resolved. When doing HttpRequest from ASP.NET. 3/8/2007 5:47 AM Nav
Is this the way we are supposed to define the proxy:

<configuration>
<appSettings>
<add key="key1" value="val1"/>
</appSettings>

<system.net>
<defaultProxy>
<proxy
usesystemdefault = "false"
proxyaddress="http://proxyserver:port"
bypassonlocal="true"
/>
</defaultProxy>
</system.net>

<system.web>
</system.web>
</configuration>

# re: Error: The underlying connection was closed: The remote name could not be resolved. When doing HttpRequest from ASP.NET. 8/9/2007 2:23 AM bhasjar
i added this to web.config but the same error is coming.we are using this in episerver

# re: Error: The underlying connection was closed: The remote name could not be resolved. When doing HttpRequest from ASP.NET. 9/6/2007 6:09 AM saikat
i also tried addin this but couldnt resolve the issue.

# re: Error: The underlying connection was closed: The remote name could not be resolved. When doing HttpRequest from ASP.NET. 10/22/2007 1:59 AM nisheed_m@rediffmail.com
i am too geting the same error

# re: Error: The underlying connection was closed: The remote name could not be resolved. When doing HttpRequest from ASP.NET. 11/15/2007 9:47 PM Ben
WebProxy proxy = New WebProxy("<your proxy address>", port num);

WebClient client = New WebClient;
client.proxy = proxy;


After you typed the above code, "client" object can get the external web information throught your proxy.

# re: Error: The underlying connection was closed: The remote name could not be resolved. When doing HttpRequest from ASP.NET. 11/28/2008 7:39 PM Himanshu
Hey Thank you very much.

Post Feedback

Title:
Name:
Email: (never displayed)
Url:
Comments: 
Please add 1 and 1 and type the answer here: