Reputation: 11602
i want to translate user entered english content to hindi language.So, for that whenever user clicks translate button, i will send a HTTP post reguest(with user entered english text) to googletranslator site.
But i got a runtime excption saying that "WebException was caught" and "Unable to connect to Remote Server".
I already turn off my firewall and virus software...
What is the problem may be...
Do i need to set or change my web application's settings...
Please Guide me to get out of this issue...
Upvotes: 2
Views: 1521
Reputation: 3854
As per the comments you can use this code:
System.Net.WebProxy pry = new System.Net.WebProxy("192.168.1.100", 2);
pry.Credentials = CredentialCache.DefaultCredentials;
GlobalProxySelection.Select = pry;
Where 192.168.1.100 is a proxy address and 2 is the port number.
Use the code before making any Http Request.
This works for me always.
Let me know if u face any problem.
EDIT
Use the code before creating a web request object
Example i use this code before:
System.Net.HttpWebRequest webReq = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://www.domain.com/horoscopes/daily/my.xml");
Upvotes: 2