Note that there are some explanatory texts on larger screens.

plurals
  1. POAccess Request Body by name in c#
    text
    copied!<p>I receive a redirect from a shop and this redirect contains this:</p> <pre><code> Connection: keep-alive Content-Length: 1023 Cache-Control: max-age=0 Origin: null User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.39 Safari/535.19 Content-Type: application/x-www-form-urlencoded Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Referer: http://republica.ipapercms.dk/LandFritid/LF/LFaviser2012/Tilbudsavis32012/iPaper.swf?build=1.0.4433.19406 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: __utma=83547913.319162761.1326373492.1326373492.1327614257.2; __utmz=83547913.1326373492.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); NOPCOMMERCE.AUTH=07F9D44B16738D2B133AAD3F6101F5D01ED26F236C01792206AA4AB8E325868D020B5B2212BE280F9905D0708431E2820B4935C75E361EA6485418420E3B63280D8F81454B52C99D79B37BEEFC207128796E3BE846F84FEF8D3AF9AAB80AA45FB76ACB3EA11EF1F2CF46B11FCD1B00309E6C3C5F70C07F54851E52207368034CBD38176A4EB4DD48C0D2CB6C17D35A4F5E61C4491DB8D890DCFA4D69BCA44096076CFCFC2B6B1247D84BFD76DD8F90FFEA20392EFED238530D6E21F7CD24C5093427A07757324E4FA8F25A36FDE35942; Nop.customer=f2d43727-9c52-4c9f-a199-6647d507e40b basket=%3Cshop%20paper%3D%22%2FLandFritid%2FLF%2FLFaviser2012%2FTilbudsavis32012%2F%22%3E%0A%20%20%3Citem%3E%0A%20%20%20%20%3Camount%3E1%3C%2Famount%3E%0A%20%20%20%20%3Cproductid%3E%3C%21%5BCDATA%5B810570%5D%5D%3E%3C%2Fproductid%3E%0A%20%20%20%20%3Cprice%3E%3C%21%5BCDATA%5B36%2E33%5D%5D%3E%3C%2Fprice%3E%0A%20%20%20%20%3Cdescription%3E%3C%21%5BCDATA%5BVed%20K%C3%B8b%20af%20minimum%203%20stk%2E%20%5D%5D%3E%3C%2Fdescription%3E%0A%20%20%20%20%3Cname%3E%3C%21%5BCDATA%5BBrilliant%20Kalk%2015%20kg%2E%5D%5D%3E%3C%2Fname%3E%0A%20%20%3C%2Fitem%3E%0A%20%20%3Citem%3E%0A%20%20%20%20%3Camount%3E1%3C%2Famount%3E%0A%20%20%20%20%3Cproductid%3E%3C%21%5BCDATA%5B863254%5D%5D%3E%3C%2Fproductid%3E%0A%20%20%20%20%3Cprice%3E%3C%21%5BCDATA%5B499%5D%5D%3E%3C%2Fprice%3E%0A%20%20%20%20%3Cdescription%3E%3C%21%5BCDATA%5B15%2B3%20kg%2E%20Hundefoder%20til%20voksne%2E%5D%5D%3E%3C%2Fdescription%3E%0A%20%20%20%20%3Cname%3E%3C%21%5BCDATA%5BRoyal%20Canin%20Maxi%20Adult%2015%2B3%20kg%2E%5D%5D%3E%3C%2Fname%3E%0A%20%20%3C%2Fitem%3E%0A%3C%2Fshop%3E </code></pre> <p>As you see there is a <code>basket</code> body parameter containing this encoded xml.</p> <p>I've tried to access it using Request.InputStream:</p> <pre><code>StreamReader reader = new StreamReader(Request.InputStream, System.Text.Encoding.UTF8); String sXMLRequest = reader.ReadToEnd(); xd.LoadXml(sXMLRequest); </code></pre> <p>but seems to fail:</p> <pre><code>System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1. at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.LoadXml(String xml) at Nop.Web.Controllers.ShoppingCartController.IPaperCheckout() </code></pre> <p>Do you know any other way to access this?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload