I've develop a module that will offer RSS xml file on fly when user click the icon. What I want is a page showing items in XML format. Just like what I can get in the Blog Module. Here is what I did, I create a user control StoryFeed.ascx, which inherites from class DotNetNuke.Entities.Modules.PortalModuleBase. Here is my code in StoryFeed.ascx .cs.
protected void Page_Load(object sender, EventArgs e)
{
//Get data from database, put them in a RssChannel class
RssChannel rss = GetChannel();
Response.Clear();
Response.ClearContent();
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ContentType = "application/xml";
//Using XmlTextWriter to output the result
rss.Write(Response.OutputStream);
//End processing of the script
Response.End();
}
However, I can't see it in the xml format because after the "<rss>....</rss>" text, there followed "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">....". It seems the Response.End() doesn't stop processing the script. How can I stop process the pipeline after I retrieved data and output them to the stream? I googled on Response.End() and found a piece on Rick Strahl's blog, I tried CompleteRequest() but no luck.
Anyone have the same problem? Need help on this.