只需要返回<?xml version='1.0' encoding='gb2312'?><MASP_RESP><RESULT>0</RESULT><RESULT_MSG>婵€娲绘垚鍔燂紒</RESULT_MSG></MASP_RESP>这些字符串,我应该怎样写返回值
我是这么写的 Response.ContentType = "text/xml";
//不要缓存
Response.AppendHeader("Cache-Control", "max-age=0");
Response.AppendHeader("Cache-Control", "no-cache");
Response.Write("<?xml version='1.0' encoding='gb2312'?>");
Response.Write("<MASP>");
Response.Write("<RESULT>200</RESULT>");
Response.Write("<CONTENT></CONTENT>");
Response.Write("</MASP>");
Response.Flush();
返回来的结果
<?xml version='1.0' encoding='gb2312'?><MASP_RESP><RESULT>0</RESULT><RESULT_MSG>婵€娲绘垚鍔燂紒</RESULT_MSG></MASP_RESP>(只要这段数据,后便的不想让客户端收到)
<!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>
<form name="form1" method="post" action="InceptData.aspx" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGTHBw/LXAGOK/vLmSNaQoo9jk5dxA==" />
<div>
</div>
</form>
</body>
</html>
Response.ContentType = "text/xml";
//不要缓存
Response.AppendHeader("Cache-Control", "max-age=0");
Response.AppendHeader("Cache-Control", "no-cache");
Response.Clear();//关键行
Response.Write("<?xml version='1.0' encoding='gb2312'?>");
Response.Write("<MASP>");
Response.Write("<RESULT>200</RESULT>");
Response.Write("<CONTENT></CONTENT>");
Response.Write("</MASP>");
Response.End();//关键行
需要加
Response.End();
将 Response.Flush(); 改成 Response.End();