asp.net - Retrieve XML from HTTP POST Request Payload -
i have activex posts server (http handler) payload of xml document.
is there better way retrieve payload xml below?
private static byte[] requestpayload() { int bytestoread = httpcontext.current.request.totalbytes; return (httpcontext.current.request.binaryread(bytestoread)); } using (var mem = new memorystream(requestpayload())) { var docu = xdocument.load(mem); } once have "docu" can query using linq xml.
thanks
simply load xml inputstream of request e.g.
xdocument doc; using (stream input = httpcontext.current.request.inputstream) { doc = xdocument.load(input); } there no need memorystream in view.
Comments
Post a Comment