CommunityRSS.aspx
The actual CommunityRSS.aspx
file in our implementation is empty except for the @Page
directive. There are no web controls on the page. Instead, we need to build an XML response and write the XML to the output stream from the code-behind. These high-level steps are reflected in the following Page_Load
method:
SectionInfo sectionInfo = null; XmlDocument xmlDoc; ServiceResponseInfo responseInfo = null; private void Page_Load(object sender, EventArgs e) { Response.ContentType = @"text/xml"; CreateRss(); xmlDoc.Save(Response.Output); }
The only method call in the Page_Load
method is to CreateRss
. When this method completes, we should have our XmlDocument
member variable filled with RSS 2.0 compliant XML. Before arriving here, the CSK’s HttpModule
determined the section the request is looking for and created a SectionInfo
object. We need to fetch the SectionInfo
object from the current context in order to build our response. We also want to cache our response to save database...