views:

41

answers:

1

My sharepoint webpart is throwing an error on my client's environment when calling HttpWebRequest.GetRequestStream (and he's using a proxy server). The error is "unable to connect to the remote server."

What's the best way to reproduce this scenario (hooking up a mock proxy) on my end so that my requests go out through the proxy server as well? This will help to debug...

+1  A: 

You can configure a proxy server in the HttpWebRequest object. As well as specifying the server address you can add any bypass addresses.

http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.proxy(v=VS.71).aspx

The proxy can also be specified in the config file. This may make it easier for you to test the solution.

http://msdn.microsoft.com/en-us/library/kd3cf2ex.aspx

fletcher
I don't use a proxy though, so what would be my address?
Prabhu
You're going to need a proxy server to test this, I don't think there's any way around it. You could host a squid proxy for testing if you don't have your own at hand:http://www.squid-cache.org/The methods above will enable you to specify a proxy for an individual web request or for a web application.
fletcher