Hi Manfred,
Thanks for your time and help.But unfortunately it is giving the following error:
"The Remote server returned an error:407:Proxy Authentication Required!"
I am running it in IE7,and I checked in the following path:Tools->internet Options->Connections->LAN Settings,and there I found that "use a proxy server for your LAN" is checked and ADdress being proxy1 and port no being 3128.
Am I missing something?
This is how my new function looks like as suggested by you:
public static string TranslateText(string input, string languagePair, Encoding encoding)
{
string url = String.Format("http://www.google.com/translate_t?hl=en&ie=UTF8&text={0}&langpair={1}", input, languagePair);
string result = String.Empty;
WebClient webClient = new WebClient();
webClient.Encoding = encoding;
NetworkCredential netcredit = new NetworkCredential("archowdhury", "Secure*45", "corp");
webClient.Credentials = netcredit;
WebProxy proxyObject = new WebProxy("http://proxy1:3128/");
proxyObject.Credentials = new System.Net.NetworkCredential("archowdhury", "Secure*45", "corp");
webClient.Proxy = proxyObject;
result = webClient.DownloadString(url);
Match m = Regex.Match(result, "(?<=<div id=result_box dir=\"ltr\">)(.*?)(?=</div>)");
if (m.Success)
result = m.Value;
return result;
}