3

I created a WCF Rest service and I am reading content sent by multipart/form data. However I get the contentdisposition and extra information. Is there a way to parse it like using HttpContext. I dont want dependency with asp...

If possible no use of external libraries, thirdparty dlls, etc... Unless its simple and consistent code I can implement.

7
  • This is just a stab in the dark, but have you tried this: OperationContext.Current.IncomingMessageHeaders. Commented Oct 9, 2012 at 4:10
  • No, but I tried HttpContext.Current.Request.Params["file"]; and I know it works but it creates dependency with IIS. Commented Oct 9, 2012 at 4:14
  • If the payload is an OData message (guessing from you tagging this as WCF Data Services), you could use ODataLib to parse it for you... Commented Oct 9, 2012 at 14:36
  • @VitekKarasMSFT Its just a file I attached. multipart/form-data Commented Oct 9, 2012 at 14:43
  • See stackoverflow.com/questions/7460088/… Commented Feb 10, 2014 at 22:52

1 Answer 1

3

In case of parsing multipart data you should use some library/class or do it manually. There is no built-in functionality. Parser is pretty easy. But you can reuse some parser classes already written.

  1. Try following project (MIT license) and file HttpMultipartParser.cs from this project:

    https://bitbucket.org/lorenzopolidori/http-form-parser/src

  2. http://multipartparser.codeplex.com/

    http://multipartparser.codeplex.com/SourceControl/changeset/view/69709#458003

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.