I'm trying to contact my webservice from an android phone using the CkHttp class. I have some security at my webservice. The webservice require the phones IMEI to be registered in my database. If the phone is not registred in my database the webservice will return a 403 - Forbidden error code:
var svcs = new CrudService.CrudServiceClient(); if (!svcs.IsDeviceAccepted(imei)) actionContext.Response = new HttpResponseMessage(HttpStatusCode.Forbidden);
This piece of code is a part of a class that inherit from a
AuthorizationFilterAttribute Class, which is a .NET class.
I will do a request to my webservice this way:
resp = http.PostJson(urlString, newStringFromBytes);
The problem is: if this
HttpStatusCode.Forbidden is being posted back, the
resp object will actually be
NULL so i cant do a
resp.get_StatusCode() in order to obtain the
HTTP Status Code
Why is the PostJson returning NULL if it can't send the HTTP Post to my server. Shouldnn't this method catch any types of error codes?
The latest version of Chilkat should not return NULL for non-success HTTP status codes. It should return the response object. If you're not using the latest version, download and test with the latest.
Thanks for the answer. I downloaded the latest version and included it in my project. But the same behaviour occur, the object is NULL. Is there anyway I can see the version code, a call to a method which will return the versioncode of the library? Just to ensure that I'm actually running the latest version.