Page 1 of 1

Unable to get HTTP Responce

Posted: Thu Nov 01, 2012 12:52 pm
by Praveen597
Hi the below is the C# code to get the HTTP response but when I tried it on Ranorex it is not working(showing error message : Namespace HttpWebRequest cannot be found)

Can you please help me out?


HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = WebRequestMethods.Http.Get;
request.CookieContainer = cc;
request.AutomaticDecompression = DecompressionMethods.GZip;

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

StreamReader reader = new StreamReader(response.GetResponseStream());

String responseString = reader.ReadToEnd();

response.Close();

return responseString;

Re: Unable to get HTTP Responce

Posted: Fri Nov 02, 2012 5:37 pm
by Support Team
Hello,

Which Ranorex version are you using?

Could you please send us the complete error message?
Are you missing the 'System.Net' namespace?

Regards,
Markus (T)