我有一个网站向我们的页面发出请求,http://www.xyz.com/test.aspx
作为回报,我们必须发回响应。以下代码是发送响应的内容。问题是它发回了 XML 数据,但它也发送了 test.aspx 的代码,我不知道如何删除它。
Random random = new Random();
int randomNumber = random.Next(0, 10000000);
attrval = randomNumber + "tty";
strCXML = "<?xml version=" + "\"" + "1.0" + "\"" + " encoding=" + "\"" + " UTF-8" + "\"" + " ?>";
strCXML =strCXML+"<!DOCTYPE cXML SYSTEM " + "\"" + "http://xml.cxml.org/schemas/cXML/1.2.023/cXML.dtd" + "\"" + ">";
strCXML = strCXML + " <cXML payloadID=" + "\"" + attrval + "\"" + " timestamp=" + "\"" + strTimeStamp + "\"" + ">";
strCXML = strCXML + "<Response>";
strCXML = strCXML + " <Status code=" + "\"" + 200 + "\"" + " text=" + "\"" + "success" + "\"" + ">" + "</Status>";
strCXML = strCXML + " <PunchOutSetupResponse> ";
strCXML = strCXML + " <StartPage>";
strCXML = strCXML + " <URL>" + strMySiteURL + "</URL>";
strCXML = strCXML + " </StartPage>";
strCXML = strCXML + " </PunchOutSetupResponse>";
strCXML = strCXML + " </Response>";
strCXML = strCXML + "</cXML>";
Response.Write(strCXML);
这工作正常,除了当它发回数据时它还包括 test.aspx 页面的 html
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title></head>
<body>
</body>
</html>
Please contact support with the Error Reference Number: ANERR-10000000000000000057040121 for more details</Status>
</Response>
</cXML>
任何想法我如何发回它,所以它只发回上面的 XML 数据。