Skip to content

Instantly share code, notes, and snippets.

@sniffdk
Last active December 11, 2015 13:08
Show Gist options
  • Save sniffdk/4605178 to your computer and use it in GitHub Desktop.
Save sniffdk/4605178 to your computer and use it in GitHub Desktop.
private HttpContext _context;
public void ProcessRequest(HttpContext context)
{
_context = context;
context.Response.ContentType = "text/plain";
context.Response.Buffer = false;
foreach (var d in Document.GetRootDocuments())
{
IndexCmsNode(d, true);
}
context.Response.Write("Done.");
}
void IndexCmsNode(CMSNode d, bool root = false)
{
// republish the document as you normally would
_context.Response.Write("Published: " + d.Id + "\r\n");
if (root)
{
foreach (CMSNode c in d.GetDescendants())
{
IndexCmsNode(c);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment