How to validate HTTP request headers before receiving request body using WCF

Posted by anelson on Stack Overflow See other posts from Stack Overflow or by anelson
Published on 2010-04-24T00:06:01Z Indexed on 2010/04/24 0:13 UTC
Read the original article Hit count: 379

Filed under:
|

I'm implementing a REST service using WCF which will be used to upload very large files. The HTTP headers in this request will communicate information which will be validated prior to allowing the upload to proceed (things like permissions, available disk space, etc). It's possible this validation will fail resulting in an error response. I'd like to do this validation prior to the client sending the body of the request, so it has a chance to detect failure before uploading potentially gigabytes of data.

RESTful web services use the HTTP 1.1 Expect: 100-continue in the request to implement this. For example Amazon S3's REST API can validate your key and ACLs in response to an object PUT operation, returning 100 Continue if all is well, indicating you may proceed to send your data.

I've rummaged around the WCF documentation and I just can't see a way to accomplish this without doing some pretty low-level hooking into the HTTP request processing pipeline. How would you suggest I solve this problem?

© Stack Overflow or respective owner

Related posts about wcf

Related posts about http