NetTalk Central

Author Topic: How to return specific HTTP status/errorcode?  (Read 4717 times)

Djordje Radovanovic

  • Full Member
  • ***
  • Posts: 237
    • View Profile
How to return specific HTTP status/errorcode?
« on: September 27, 2018, 05:11:24 AM »
In some cases I need to return specific status code, 200, 401, 500+, whatever.

How can I do it?

Best regards,

Djordje Radovanovic

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: How to return specific HTTP status/errorcode?
« Reply #1 on: September 27, 2018, 08:01:34 PM »
Hi Djordje,

Depending upon the status code, you do things a bit differently:

Status Code 2XX

p_web.ReplyResponseNumber = 201

200 and 206 are handled by NetTalk automatically (and maybe others)

Status Codes 3XX

p_web.Redirect('http://somewhereelse.com',,,301)


Status Codes 4XX & 5XX

p_web.SendError(401,'Unauthorized','You must authorize to use this service')


Regards
Bill