login about faq

Hi!

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?

asked Jan 24 '13 at 07:50

Tobias's gravatar image

Tobias
6223


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.

link

answered Jan 24 '13 at 08:12

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

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.

link

answered Jan 24 '13 at 08:44

Tobias's gravatar image

Tobias
6223

Examine the contents of the LastErrorText after calling PostJson.

(Jan 24 '13 at 08:48) chilkat ♦♦

There should be a line that indicates the "DllDate". The latest version would show a date in late December 2012.

(Jan 24 '13 at 08:49) chilkat ♦♦

Thanks alot!

(Jan 24 '13 at 09:04) Tobias
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×45
×33

Asked: Jan 24 '13 at 07:50

Seen: 1,824 times

Last updated: Jan 24 '13 at 09:04

powered by OSQA