NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Djordje Radovanovic on September 27, 2018, 05:11:24 AM

Title: How to return specific HTTP status/errorcode?
Post by: Djordje Radovanovic 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
Title: Re: How to return specific HTTP status/errorcode?
Post by: bshields 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