2

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...

enter image description here

7
  • I think you have the URL of the google translate server incorrect. Can you post the code of this area? Commented Jun 13, 2012 at 9:50
  • 3
    First of all you must give us some code, and not this image. Second google translate protect his contents with complex second and third javascript call and you can not make what you try now. So try to use google api for translation, or find some other site with less security than google. Also there is the case that google have block you if you have made more than x calls / day from the same ip. Commented Jun 13, 2012 at 11:08
  • @ Kamal Deep Singh:No,i am not using any proxy... Commented Jun 13, 2012 at 11:08
  • Posting code wouldn't hurt... But i'd first POST all hidden fields then use a REFERRER and also an USERAGENT header since translate.google.com can be used without JS. Commented Jun 13, 2012 at 11:41
  • Acutally, just now i saw the difference.that is, i have created a simple asp.net web application(small module) that provide the functionality for translation.Actually, this code working fine.But when i integrated with my main project,then it raised that problem...could you help me with this... any web settings caused this problem?... Commented Jun 13, 2012 at 11:46

1 Answer 1

2

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"); 
Sign up to request clarification or add additional context in comments.

2 Comments

@Saravanan In the Page_Load or before making any Web Request object. I have updated the code
@Saravanan But make sure to accept the answer if and only if it works.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.