예제 #1
0
        public ActionResult GetFeedLink(string slug)
        {
            var         resp = _siteViewApi.GetFeedLink(slug);
            XmlDocument doc  = new XmlDocument();

            doc.Load(resp.Result.DownloadLink);
            var ms = new MemoryStream(Encoding.ASCII.GetBytes(doc.OuterXml.ToString()));

            return(new FileStreamResult(ms, "text/xml"));
        }
예제 #2
0
        public ActionResult GetFeedLink(string slug)
        {
            var resp = _siteViewApi.GetFeedLink(slug);
            var ext  = Path.GetExtension(slug);

            ext = ext == ""? ".xml":ext;
            var body = "";

            if (ext == ".xml")
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(resp.Result.DownloadLink);
                body = doc.OuterXml.ToString();
            }
            else
            {
                using (var wc = new System.Net.WebClient())
                    body = wc.DownloadString(resp.Result.DownloadLink);
            }

            var ms = new MemoryStream(Encoding.ASCII.GetBytes(body));

            return(new FileStreamResult(ms, "text/" + ext.Replace(".", "")));
        }