Guest User

Untitled

a guest
Sep 25th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. try {
  2.     // Initialize a new instance of the MemoryStream class.
  3.     using (MemoryStream MemoryStream = new MemoryStream()) {
  4.         // Copy the contents of the incoming HTTP entity body to the memory stream.
  5.         Request.InputStream.CopyTo(MemoryStream);
  6.         // Create a binding for a type with the provided values.
  7.         YOUR_TYPE_HERE Bound = (YOUR_TYPE_HERE)JsonConvert.DeserializeObject(Request.ContentEncoding.GetString(MemoryStream.ToArray()), typeof(YOUR_TYPE_HERE));
  8.         // HANDLE BINDING
  9.     }
  10. } catch {
  11.     // HANDLE FAILURE
  12. }
Add Comment
Please, Sign In to add comment