Response.Http method
Creates a response with exactly the status, body and headers you give it.
public static Response Http(ushort status, byte[] body,
IReadOnlyList<KeyValuePair<string, string>> headers)
| parameter | description |
|---|---|
| status | The HTTP status code, such as 200 or 302. |
| body | The response body; pass an empty array for none. |
| headers | The response headers, one entry for each value. To send a header twice, as with two cookies, add two entries with the same name. |
Remarks
Use it when the other methods do not set the headers you need: a redirect's location, a set-cookie, caching headers. No header is added for you, so include content-type when the response has a body.
Examples
A redirect:
return Response.Http(302, [], [new("location", "/login")]);