简体   繁体   English

如何设置可用于测试与Http请求相关的功能的Web代理?

[英]How do I set up a Web Proxy that I can use to test functionality related to Http Requests?

one of the users of my applications must connect to a web proxy before he can connect to our website. 我的应用程序的用户之一必须先连接到Web代理,然后才能连接到我们的网站。 he tells me that he keeps getting 401 errors even when he specifies the proxy's ip, port, username & password. 他告诉我,即使他指定代理的ip,端口,用户名和密码,他仍然会收到401错误。 I have no way to test this functionality because I don't need to use a proxy to connect to our website. 我无法测试此功能,因为不需要使用代理连接到我们的网站。 For all I know the problem relates to the way I am making the HttpRequest, but again, I have no way to test this functionality. 就我所知,这个问题与我制作HttpRequest的方式有关,但是同样,我没有办法测试此功能。

How can I set up a web proxy that will allow me to test this functionality? 如何设置网络代理以测试该功能?

Of you are on Windows, go grab CC Proxy http://www.youngzsoft.net/ccproxy/ and install it. 在Windows中,请获取CC代理http://www.youngzsoft.net/ccproxy/并进行安装。 It's free and and can be configured to your needs. 它是免费的,可以根据您的需要进行配置。

You could assign the Proxy property on the HttpWebRequest . 您可以在HttpWebRequest上分配Proxy属性。

For example here's how you could specify a proxy server using default network credentials: 例如,以下是使用默认网络凭据指定代理服务器的方法:

var request = WebRequest.Create("http://www.google.com");
request.Proxy = new WebProxy("http://proxy.mydomain.com", 8080);
request.Proxy.Credentials = CredentialCache.DefaultNetworkCredentials;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM