public static void ProcessRequest(HttpContextBase context)
{
const int pageSize = 15;
var entries = new List <ErrorLogEntry>(pageSize);
var log = ErrorLog.GetDefault(context);
log.GetErrors(0, pageSize, entries);
var response = context.Response;
response.ContentType = "application/xml";
var title = string.Format(@"Error log of {0} on {1}",
log.ApplicationName, Environment.MachineName);
var link = ErrorLogPageFactory.GetRequestUrl(context).GetLeftPart(UriPartial.Authority) + context.Request.ServerVariables["URL"];
var baseUrl = new Uri(link.TrimEnd('/') + "/");
var items =
from entry in entries
let error = entry.Error
select RssXml.Item(
error.Message,
"An error of type " + error.Type + " occurred. " + error.Message,
error.Time,
baseUrl + "detail?id=" + Uri.EscapeDataString(entry.Id));
var rss = RssXml.Rss(title, link, "Log of recent errors", items);
response.Write(XmlText.StripIllegalXmlCharacters(rss.ToString()));
}