コード例 #1
0
        private void GetArticles()
        {
            string url = "https://www.wired.com/feed/";


            using (var stream = new ModifiedWebClient().OpenRead(url))
            {
                using (var sr = new StreamReader(stream))
                {
                    using (var reader = XmlReader.Create(sr))
                    {
                        Konular = new List <ArticlesModel>();

                        var feed = SyndicationFeed.Load(reader);
                        foreach (var item in feed.Items)
                        {
                            ArticlesModel makale = new ArticlesModel();
                            makale.Baslik  = item.Title.Text;
                            makale.KonuUrl = item.Id;
                            Konular.Add(makale);
                        }
                    }
                }
            }
            Konular = Konular.Take(5).ToList();
        }
コード例 #2
0
        public static void TestWorkaround()
        {
            ModifiedWebClient wc = new ModifiedWebClient();

            // wc.Headers.Add("Host", "redmine.cor.local");
            // wc.Headers.Set("Host", "redmine.cor.local");
            // wc.Headers["Host"] = "redmine.cor.local";

            string str = wc.DownloadString("http://redmine.cor-management.ch");

            System.Console.WriteLine(str);
        }