I’m trying to debug an exception that happens once in a blue moon with HttpWebRequest. However, i have no idea how to get the body nor header. I saw an answer on SO but it was clearly incorrect as you cant cast the exception to the class he was thinking of.
I tried grabbing the response stream and got a verb error. I googled “msdn httpwebrequest exception get headers” but it mostly talks about headers in the httpwebrequest and list possible exceptions… not what i wanted.
If you get a
WebException, you can get the response from that usingWebException.Response. It’s not clear what exception you’ve actually got though, or whether this is the answer you’ve already seen elsewhere… if this doesn’t help you, please give more information.