I
iana_kosio
Hi,
I am using HttpWebRequest class to communicate with remote server. In some cases the server would return 5xx status code which results in HttpWebRequest object throwing an exception. I, however, still need to access the response stream from the server as it contains information that I need. Any ideas how I can do that?
Thanks,
Konstantin
try
{
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://localhost/myUrl");
myRequest.Method = "GET";
WebResponse response = myRequest.GetResponse();
//If the server returns 5xx status code the next statement executed will be in the catch block
//Nevertheless, I still need the response stream from the server
Stream responseStream = response.GetResponseStream();
}
catch (System.Exception exc)
{
//Process exception
//How can I access the response stream from here?
}
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
I am using HttpWebRequest class to communicate with remote server. In some cases the server would return 5xx status code which results in HttpWebRequest object throwing an exception. I, however, still need to access the response stream from the server as it contains information that I need. Any ideas how I can do that?
Thanks,
Konstantin
try
{
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://localhost/myUrl");
myRequest.Method = "GET";
WebResponse response = myRequest.GetResponse();
//If the server returns 5xx status code the next statement executed will be in the catch block
//Nevertheless, I still need the response stream from the server
Stream responseStream = response.GetResponseStream();
}
catch (System.Exception exc)
{
//Process exception
//How can I access the response stream from here?
}
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...