J
jamesmc
Guest
Hi, I am successfully using the WebClient class in my code to send data to a server using the UploadValues method. When this works I receive a JSON object back containing, among other things, a status code of 1. If I send some invalid data to the server I should still receive a JSON object back but this time the status code should be 0 to indicate there was a problem. When the server issues a status of 0 it also raises a HTTP 4xx error which the WebClient throws as a System.Net.WebException. Is there a way to ignore the WebException because when my CATCH block catches it I dont actually receive my JSON object. I am using 10.2B08. Thanks. My code looks like the following: ASSIGN lvWebClient = NEW System.Net.WebClient(). ASSIGN lvByteResult = lvWebClient:UploadValues("serveraddress", lvParameters). ASSIGN lvEncoder = NEW System.Text.ASCIIEncoding(). ASSIGN lvJsonString = lvEncoder:GetString(lvByteResult). ASSIGN lvReturnValue = TRUE. CATCH e AS System.Net.WebException: ASSIGN THIS-OBJECT:ErrorMessage = e:getMessage(1). END CATCH .
Continue reading...
Continue reading...