这个问题已经有了答案:
How do I decode a URL parameter using C#?
5个答案
我有一个从外部支付门户获取数据的控制器,格式如下:
%3c门户网站+xmlns%3d%3d%22http%3d%22http%3A%2f%2fwww.e-paycapital.com%2fwww.e-paycapital.com%2f门户网站%22%3e%3c请求ID%3e%3c%3c%2f请求ID%3e%3c%3c请求状态%3e%3c%3c%3c%3c%2f状态代码%3e%3c消息%3e%3c消息%3e%3c消息%3e%3c消息%3ep支付+-+销售+-+处理+处理+已成功完成+成功+完成+成功+成功+成功+成功地%3c%3c%2f消息%3c%2f消息%3e%3e%3c%33e%26quot%3bauth+cod%3E%3A1100955%26quot%3B%3C%3C%2F邮件%3E%3E%3CAuth代码%3E100955%3E100955%3C%2F身份验证%3E%3C%3E10000%3C%3C%3E%3C%3E%3E%3C%3E%3C%3E%3C%3E%3E%3A1100955%26quot%3C%3C%2F%3E%3E%3A1100955%26quot%3B%3C%2F%3C%3F%3E%3F%3E%3E%3C%3C%3C%3E%3C%3E%3C%3C%3C%3C%3C%3C E%3cmop%3e51%3c%2fmop%3e%3ccart%3e%3citems%3e%3citem%3e%3core引用%3EA7000%3C%2Freference%3E%3Creference2%3E1234%3C%2Freference2%3E%3Ccan%3E2506%3C%2Fcan%3E%3Cfundcode%3E8%3C%2Ffundcode%3E%3Camount%3E10000%3C%2Famount%3E%3C%2Fitem%3E%3C%2Fitems%3E%3C%2Fcart%3E%3C%2Fportalres%3E
如何将其放入c中的XmlDocument对象?

最佳答案

如果状态包含字符串:

var xml = new XmlDocument();
xml.LoadXml(HttpUtility.UrlDecode(status));

数据(状态)如下:
<portalRes xmlns="http://www.e-paycapita.com/portal">
  <requestID>7</requestID>
  <reqStatus>
    <statusCode>0</statusCode>
    <message>Payment - Sale - Processing completed successfully.</message>
  </reqStatus>
  <authDetail>
    <responseCode>00</responseCode>
    <message>&quot;AUTH CODE:100955&quot;</message>
    <authCode>100955</authCode>
    <amount>10000</amount>
    <can>2506</can>
  </authDetail>
  <surcharge>
    <fundCode>CSRCH</fundCode>
    <reference>A15009581</reference>
    <amount>175</amount>
  </surcharge>
  <mop>51</mop>
  <cart>
    <items>
      <item>
        <reference>A7000</reference>
        <reference2>1234</reference2>
        <can>2506</can>
        <fundCode>8</fundCode>
        <amount>10000</amount>
      </item>
    </items>
  </cart>

关于c# - C#解码request.inputstream ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21931378/

10-11 03:56