WEBSERVICE HTTPWebRequest request.GetResponse() DOES NOT WORK

Good afternoon,

the request.GetResponse () command is not being recognized.

this and example code:

using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
if (response.StatusCode != HttpStatusCode.OK)
Console.Out.WriteLine("Error fetching data. Server returned status code: {0}", response.StatusCode);
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
var content = reader.ReadToEnd();
if(string.IsNullOrWhiteSpace(content)) {
Console.Out.WriteLine("Response contained empty body...");
}
else {
Console.Out.WriteLine("Response Body: \r\n {0}", content);
}

            Assert.NotNull(content);

}

I appreciate the help

Sign In or Register to comment.