Lasso Soft Inc. > Home

[ web_response->setStatus ]

Method

The [web_response->setStatus] method takes a status code (integer) and a message string and sets that as the HTTP status for the response you are generating.

  • Syntax
web_response->setStatus(code, message)
Examples
  • Beginner

Set the HTTP response to Unauthorized

The code below shows how you would set the HTTP response status to "401 Unauthorized" if someone tried to access a page that required authentication, but they were not logged in.

Code

web_response->setStatus(401, 'Unauthorized')

Result

//HTTP response header set to "401 Unauthorized"

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft