Unable to get HTTP Responce

Ask general questions here.
Praveen597
Posts: 27
Joined: Sat Aug 27, 2011 9:41 am

Unable to get HTTP Responce

Post by Praveen597 » Thu Nov 01, 2012 12:52 pm

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;

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Unable to get HTTP Responce

Post by Support Team » Fri Nov 02, 2012 5:37 pm

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