Elmah.RssXml.Rss C# (CSharp) Méthode

Rss() public static méthode

public static Rss ( string title, string link, string description, IEnumerable items ) : System.Xml.Linq.XElement
title string
link string
description string
items IEnumerable
Résultat System.Xml.Linq.XElement
        public static XElement Rss(string title, string link, string description, IEnumerable<XElement> items)
        {
            return
                new XElement("rss",
                    new XAttribute("version", "0.91"), // http://backend.userland.com/rss091
                    new XElement("channel",
                        new XElement("title", title),
                        new XElement("link", link),
                        new XElement("description", description),
                        new XElement("language", "en"),
                        items));
        }

Usage Example

Exemple #1
0
        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()));
        }
All Usage Examples Of Elmah.RssXml::Rss