I have set up motion detection on an IP camera (Sercomm RC8021) using an HTTP POST. Upon detecting motion, the camera initiates an HTTP POST, attaching an MP$ video in the post body. I have an ASP.NET page with C# code-behind attempting to save the file:
protected void Page_Load(object sender, EventArgs e)
{
String filename = "~/MotionDetectAttachment.mp4";
this.Context.Request.SaveAs(Server.MapPath(filename), false);
}
The problem is that the server sends an HTTP 500 code back to the camera and the file is not saved. Using wireshark, the communication seems to be fine until wireshark tags a packet with "TCP Window Full", followed by a series of ZeroWindow and Keep-Alive messages. Eventually the connection is reset, and the camera logs a 500 response from the server.
Any ideas on what I'm doing wrong? Other answers to similar questions refer to SaveAs being a way to save to file, but none of the other questions I read mentioned the wireshark issues.
Camera log sample:
11/02/2012 11:38:35 HTTP-POST:Failed to post file [HTTP error code: 500].
11/02/2012 11:38:03 Alert: Detected motion.
Part of the HTTP header from Wireshark logs:
POST /PFDemo/MotionDetectAttachment.aspx?cameraID=1 HTTP/1.0
Host: {correct host IP}
Content-Type: video/mp4
Content-Length: 158689
Authorization: Basic
Connection:close
X-EventInfo: motion,71,md_window3
(the X-EventInfo values are from the camera)