.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

HttpWebRequest response problem.

Posted By: Kapil     Posted Date: February 23, 2011    Points:2   Category :ASP.Net
I've some problem with HttpWebRequest.When i configure virtual directory , i am getting proper response,but my code is working fine when i run my code to .net. i've windows 7 and iis 7.5. this is my code.

string text = "Translate this for me";
string from = "en";
string to = "hi";
string detectUri = "http://www.google.com/translate_t?hl=en&ie=UTF8&text=" + text + "&langpair=" + from + "|" + to;
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(detectUri);
WebResponse resp = httpWebRequest.GetResponse();
Stream strm = resp.GetResponseStream();
StreamReader reader = new System.IO.StreamReader(strm);
string translation = reader.ReadToEnd();
string regURL = "(?is).*?(class=\"short_text\">)(.*)(</span></div></div><div id=gt-res-tools).*?";
Match match = Regex.Match(translation, regURL, RegexOptions.IgnoreCase);
// Here we check the Match instance.
if (match.Success)
// Finally, we get the Group value and display it.
string key = match.Groups[2].Value;
Response.Write("<br/>" + key);
Response.Write("not available");

plz help me.

Author: Sunil Yadav       [Moderator]      
Posted Date: February 23, 2011     Points: 5   

What error you are getting when configuring virtual directory?

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend