i'm using asp.net webclient http post. have try catch around code catch webexception.
try { using (mywebclient wc = new mywebclient()) { wc.headers[httprequestheader.contenttype] = _lender.contenttype; wc.timeout = 200; return _lender.getresult(wc.uploadstring(_lender.posturi, _lender.postvalues)); } } catch (webexception ex) { return new serviceerror(ex.status.tostring()); }
the main exceptions i'm looking timeouts. i've extended webclient allow me set timeout.
when set timeout 100ms, exception thrown expected. can webexception status per example (it returns "timout"), want return status codes too.
if drill down httpwebresponse using ex.response, null value returned, when expecting associated status code. why not httpstatus.request.timeout?
Comments
Post a Comment