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

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -