This project is read-only.

WebServerSample form posting

Jun 5, 2012 at 5:19 PM

Is there a good example on how to handle form post/get requests? I'm using the WebServerSample in the latest trunk and it has the OnRequest. It throws the post request fine, and i can write out the response (e.response.body.write(...)) but it shows a 404 file not found error, and if i point it towards a real file, the Server.RequestReceived event isn't thrown




Aug 9, 2012 at 8:48 PM

Ever figure out the answer this this question?  Would LOVE to know.

Aug 10, 2012 at 9:15 AM

Usually a request will be handled by a server module. The OnRequest event is like a last resort - it only gets fired if no module could handle the request.

The behavior described by the op can be explained as following:

  1. Click on form submit button in browser
  2. Browser sends POST request for ""
  3. Server tries to handle request checking all registered modules
  4. No module is found: server fires OnRequest event
  5. Server sends 404 error

Even if you set the IsHandled property to true, the 404 will be shown. This means, you should always have a module handling your request (sounds reasonable).

Now if you change the forms action to point to a uri which the server can handle, everything is fine. You could for example use PHP for this, see