HTTP POST returns "303 See Other"
An HTTP server may return a 303 status code after receiving a POST, HEAD, or OPTIONS request. This indicates that the client should make another GET request to the resource returned in the Location header of the response. A basic example in C# showing how to do this is below.
Http client = new Http();
try
{
client.Post("http://www.a-server.com/some-resource");
}
catch (IPWorksHttpException ex)
{
if (ex.Code == 151) // 151 means there was an error in the HTTP response.
{
if (client.StatusLine.Contains("303")) // 303 is the HTTP response error.
{
foreach(Header header in client.ParsedHeaders)
{
if(header.Field.ToLower() == "location") // Location has the URL to GET next.
{
client.Get(header.Value);
}
}
}
}
}
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.