Hello all when I try to Handle my WebException I'm getting a NullReferenceException when I try to Display the Error. Here is my code:
RaiseEvent UpdateResponse(threadID, CType(Err.Response, HttpWebResponse).StatusCode.ToString & " - " & CType(Err.Response, HttpWebResponse).StatusDescription)
Is where i get the NullReferenceException, Err.response is "nothing" in the debugger, WebException.Response suppose to return the WebResponse type of the exception? Thanks in advance.
VB.NET:
Try
res = req.GetResponse()
RaiseEvent UpdateResponse(threadID, res.StatusCode.ToString & " - " & res.StatusDescription)
res.Close()
Catch Err As WebException
If Err.Status = WebExceptionStatus.ProtocolError Then
RaiseEvent UpdateResponse(threadID, "401 - Unauthorised")
Else
RaiseEvent UpdateResponse(threadID, CType(Err.Response, HttpWebResponse).StatusCode.ToString & " - " & CType(Err.Response, HttpWebResponse).StatusDescription)
RetryComboNeedNewProxy = True
End If
End Try
Is where i get the NullReferenceException, Err.response is "nothing" in the debugger, WebException.Response suppose to return the WebResponse type of the exception? Thanks in advance.