Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
XML
<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
Posted
Updated 24-Feb-11 5:01am
v2

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" %>
 
Share this answer
 
Use a generic handler (.ashx) instead of ASP page (.aspx)
You should also set Response.ContentType = "text/xml"
 
Share this answer
 
Ok i have done

i have attached two lines

Page.Response.End();
Page.Response.Close();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900