Setting Up HTTP Proxy Parameters in TCP-based Client Components

 
 

1. Assigning HTTP proxy to the TclHttp component.

 
private void btnHttp_Click(object sender, EventArgs e)
{
	http1.ProxySettings.UserName = "user";
	http1.ProxySettings.Password = "psw";
	http1.ProxySettings.Server = "proxy-domain.com";
	http1.ProxySettings.Port = 8080;

	string response = http1.Get("https://www.clevercomponents.com/checknews/clnews.html");
}
 

2. Assigning HTTP proxy to the TclFtp component.

private void btnFptProxy_Click(object sender, EventArgs e)
{
	ftp1.ProxySettings.UserName = "user";
	ftp1.ProxySettings.Password = "psw";
	ftp1.ProxySettings.Server = "proxy-domain.com";
	ftp1.ProxySettings.Port = 8080;
	ftp1.ProxySettings.ProxyType = FtpProxyType.HttpConnect;

	ftp1.UserName = "ftp-user";
	ftp1.Password = "secret";
	ftp1.Server = "ftp-host";
	ftp1.Port = 21;
	ftp1.Open();
}
 

3. Assigning HTTP proxy to the TclSmtp component.

The SMTP protocol doesn't directly support HTTP proxy. You need to add an additional component, TclHttpProxy, and assign the TclSmtp.Proxy property with an instance of this component. Other TCP-based client components (TclImap4, TclPop3, TclSFtp, etc.) are configured in the same way.
 
private void btnSMPT_Click(object sender, EventArgs e)
{
	httpProxy1.UserName = "user";
	httpProxy1.Password = "psw";
	httpProxy1.Server = "proxy-domain.com";
	httpProxy1.Port = 8080;

	smtp1.Proxy = httpProxy1;

	smtp1.UserName ="mail-user";
	smtp1.Password = "secret";
	smtp1.Server = "mail-host";
	smtp1.Port = 25;
	smtp1.Open();
}

Add Feedback