开发者

Rss: Bookmark is not working correctly

I'm working on project RSS generation in MVC.Net. in taht i want to make bookmark. for that i have write the code on controller. first there is one aspx page from which subscription page gets open.

public ActionResult ViewBlog() { if (Session[SessionVariables.username] == null) { return RedirectToAction("Login", "Home"); } 开发者_如何学C else { return View(classObj.fetchAllBlogs()); } }

and coding for subscription is: public ActionResult Rss() {

           string bcontent = classObj.showBlog();
           DateTime postdate = classObj.showPostDate();

           List<SyndicationItem> items = new SyndicationItem[] 
        {
            new SyndicationItem("RSS Blog",bcontent+postdate,null),       
        }.ToList();

           RssResult r = new RssResult();
           SyndicationFeed feed = new SyndicationFeed("Admin: Blog Posts", "RSS Feed",Request.Url , items);
           return new RssResult(feed);

        Developer", "The latest news on ASP.NET, C# and ASP.NET MVC ");
    }

but problem is that when usr clicks on bookmark then intested of opening ViewBlog.aspx it opens the same page. i want to open ViewBlog.aspx. I think the problem is in: SyndicationFeed feed = new SyndicationFeed("Admin: Blog Posts", "RSS Feed",Request.Url , items);

Plz help ...!


The 3rd parameter of the SyndicationFeed constructor should be the URL of the RSS feed. If this doesn't change then I would just hard code it.

Like they've done in the example in the MS docs.

SyndicationFeed feed = new SyndicationFeed("My Data Feed", "This is a sample feed", new Uri("http://localhost/MyDataService"), items);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜