C
Chizl
dev: Visual Studio 2008, C#
I'm looking for the ResponseStatus code from a web page once I use:
HttpWebRequest whr = (HttpWebRequest)WebRequest.Create(strURL);
whr.Method = "GET";
This next line will fail is there is a status 404 on the above create, but
after spending about an hour into this I'm not finding the status code
response.
WebResponse wr = whr.GetResponse();
I found a page that looked like there was a HttpWebRequest.ResponseStatus,
but when I look for it in the code, I couldn't find it. While I have it
running in memory, I've gone through and found something under the
"Non-Public Members" that says whr.ResponseStatusCode="NotFound". However,
it's private so I can't figure out the property I need to call to access it.
I have a try catch, and the failure occurs on the whr.GetResponse saying the
web server responding with "404" as the Exception Message. I would prefer
to know the status before I throw an error.
I'm looking for the ResponseStatus code from a web page once I use:
HttpWebRequest whr = (HttpWebRequest)WebRequest.Create(strURL);
whr.Method = "GET";
This next line will fail is there is a status 404 on the above create, but
after spending about an hour into this I'm not finding the status code
response.
WebResponse wr = whr.GetResponse();
I found a page that looked like there was a HttpWebRequest.ResponseStatus,
but when I look for it in the code, I couldn't find it. While I have it
running in memory, I've gone through and found something under the
"Non-Public Members" that says whr.ResponseStatusCode="NotFound". However,
it's private so I can't figure out the property I need to call to access it.
I have a try catch, and the failure occurs on the whr.GetResponse saying the
web server responding with "404" as the Exception Message. I would prefer
to know the status before I throw an error.