如何在没有页面代码的情况下获得页面响应?

如何在没有页面代码的情况下获得页面响应?

问题描述:


我正在尝试以XML响应的形式发送对其他网站的请求的响应.

它以XML以及页面代码发送响应.但是我只想发送XML作为响应,而不发送页面代码:

Hi,
I am trying to send response to the request made by other website in the form of XML Response.

It sends the response in XML as well as page code. But i want to send only XML as response not the page code:

<DocumentElement><LeadMinimal><SSN>385213456</SSN><ZIP>10019</ZIP><GMI>2400</GMI><LeadTypeId>13</LeadTypeId><Status>Rejected</Status><Price>0</Price><L_LEADID>0</L_LEADID><MAXTIME>0</MAXTIME><Message>Duplicate Lead</Message></LeadMinimal></DocumentElement>

<!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 id="Head1"><link href="App_Themes/IceBlueTheme/Controls.css" type="text/css" rel="stylesheet" /><title>

</title></head>
<body>
    <form name="form1" method="post" action="Ping.aspx" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2MTY2ODcyMjlkZNbA51cgqMKs8IpT6MgyQBOzhFQ+nGMa+sveUrJfyUMY" />

    <div>
    </div>
    </form>
</body>
</html>


请帮助我


Please help me

从.aspx页面中删除除ASP.Net页面声明之外的所有内容(即html部分,包括head,body ...).它应该看起来像这样:

From your .aspx page remove everything (i.e. html part including head, body...) except the ASP.Net Page declaration. It should look something like this:

<%@ Page language="c#"  Inherits="MyPage" CodeFile="MyPage.aspx.cs" %>


使用通用处理程序(.ashx)代替ASP页面(.aspx)
您还应该设置Response.ContentType = "text/xml"
Use a generic handler (.ashx) instead of ASP page (.aspx)
You should also set Response.ContentType = "text/xml"


好,我已经完成了

我已经附上了两条线

Page.Response.End();
Page.Response.Close();
Ok i have done

i have attached two lines

Page.Response.End();
Page.Response.Close();