public static Rss ( string title, string link, string description, IEnumerable |
||
title | string | |
link | string | |
description | string | |
items | IEnumerable |
|
return | System.Xml.Linq.XElement |
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())); }
public static void ProcessRequest(HttpContextBase context) { var log = ErrorLog.GetDefault(context); var request = context.Request; var response = context.Response; response.ContentType = "application/xml"; var title = string.Format(@"Daily digest of errors in {0} on {1}", log.ApplicationName, Environment.MachineName); var link = ErrorLogPageFactory.GetRequestUrl(context).GetLeftPart(UriPartial.Authority) + request.ServerVariables["URL"]; var baseUrl = new Uri(link.TrimEnd('/') + "/"); var items = GetItems(log, baseUrl, 30, 30).Take(30); var rss = RssXml.Rss(title, link, "Daily digest of application errors", items); context.Response.Write(XmlText.StripIllegalXmlCharacters(rss.ToString())); }