aspx中返回XMl格式的文件 请问,我现在有一个Default.aspx文件,当有人访问这个Default.asp页面的时候,我会返回一个XML格式的字符串给那个访问者,但是我怎么每次返回的都是页面的HTML,请问这是什么原因? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Response.ContentType = "text/xml"; 要不然在前台页面的head里面加<meta http-equiv="content-type" content="text/xml"/>这个应该也是可以的 你就在.aspx页面的head标签中间加<meta http-equiv="content-type" content="text/xml"/> 试试这个是html知识了 加了没用。我在 Default页面的Page_Load函数中加了StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\" encoding=\"gbk\"?>"); .Append("<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchemainstance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" >"); .Append("<soapenv:Body>"); .Append("<ns3:MoSOAPRespBody xmlns:ns3=\"http://123.com/esms/\">"); .Append("<ns3:message>"); .Append("<id>"+id+"</id>"); .Append("<result>"+"1"+"</result>"); .Append("</ns3:message>"); .Append("/ns3:MoSOAPRespBody"); .Append("</soapenv:Body>"); .Append("</soapenv:Envelope>"); Response.ContentType = "text/xml"; this.Response.Write(returnValue);我要返回这个XML, 页面是一个<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!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 runat="server"> <meta http-equiv="content-type" content="text/xml"/> <title></title></head><body></body></html>请问我该怎么返回? VS系统发布时无法包含XML 怎么判断一个路径是否带运行参数? UpdatePanel crystalReport的问题 急!请问:如何在C#中连接EXCEL表?能不能给出例子? 放分~~~求接口的概念~~ winform求助--splitcontainer C#Oracle数据库操作的棘手问题? 求经济管理论文一篇(详细请看..........) 请教正则判断:一个手机号只由3位数字组成 各位大哥请推荐一些C#电子项目教程 求一个反混淆的工具
<meta http-equiv="content-type" content="text/xml"/>
这个应该也是可以的
<meta http-equiv="content-type" content="text/xml"/>
试试
这个是html知识了
我在 Default页面的Page_Load函数中加了
StringBuilder xml = new StringBuilder();
xml.Append("<?xml version=\"1.0\" encoding=\"gbk\"?>");
.Append("<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchemainstance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" >");
.Append("<soapenv:Body>");
.Append("<ns3:MoSOAPRespBody xmlns:ns3=\"http://123.com/esms/\">");
.Append("<ns3:message>");
.Append("<id>"+id+"</id>");
.Append("<result>"+"1"+"</result>");
.Append("</ns3:message>");
.Append("/ns3:MoSOAPRespBody");
.Append("</soapenv:Body>");
.Append("</soapenv:Envelope>"); Response.ContentType = "text/xml";
this.Response.Write(returnValue);
我要返回这个XML, 页面是一个<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!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 runat="server">
<meta http-equiv="content-type" content="text/xml"/>
<title></title>
</head>
<body></body>
</html>请问我该怎么返回?