Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9286605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:27:29+00:00 2026-06-18T19:27:29+00:00

I know that to generate rss I can use built-in classes like SyndicationFeed and

  • 0

I know that to generate rss I can use built-in classes like SyndicationFeed and Rss20FeedFormatter. Also I know that it can be done with custom classes and aspx view.

But if I want to create custom feed objects and custom view, can I do this using razor?

Here is my view:

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<h2>@Model.Title</h2>
<div><b>Description:</b> @Model.Description</div>
<div><b>Language:</b> @Model.Language</div>
<a href="@Model.Url" class="averageLink">Subscribe to this Feed</a>

@foreach (var item in Model.Items)
{
    <h3>
        Title: @item.Title 
    </h3>
    <div>
        <img width="75" height="75" src="@Url.Action("GetImage", "Store", new { productId = item.ProductId })"/>
    </div>
    <div><b>Description:</b> @item.Description</div>
    <div><b>Creator:</b> @item.Creator</div>
    <div><b>Date published</b> @item.Published</div>
    <div>
        <a href="@item.Url" class="averageLink">place order on Ozon</a>
    </div>
    @Html.ActionLink("go to item", "ItemInformation", "Store", new {itemId = item.ItemId}, new {@class = "averageLink"})
}
</channel>
</rss>

Other questions:

1) I don’t know how exactly to implement “subscription” link: what value to assign to the @Model.Url?

2) It generates html, mabby instead I need to serialize my feed objects into xml document and return it with a custom XmlResult : ActionResult?

Edit 1: Mabby I somehow can use built-in classes and custom feed model together?

Edit 2: The reason I don’t want to use the existing classes is because I need to use Html.ActionLink() and Url.Action() helpers. If I serialize feed object into xml how would I use these helper methods?

Thanks for help in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T19:27:31+00:00Added an answer on June 18, 2026 at 7:27 pm

    Your view code is producing html, not the xml that is needed for an rss feed (you are including elements like div and h3 that are part of html).

    To produce a view that outputs RSS, the layout of the view should replicate the RSS standard.

    For example:

    @model MyProject.Models.RssModel
    @{ Layout = null }
    
    <?xml version="1.0" encoding="UTF-8" ?>
    <rss version="2.0">
    <channel>
      <title>@model.FeedTitle</title>
      <description>@model.FeedDescription</description>
      <link>@model.FeedLink</link>
      <lastBuildDate>@model.LastBuildDate</lastBuildDate>
      <pubDate>@model.PubDate</pubDate>
      <ttl>@model.Ttl</ttl>
      @foreach (var item in Model.Items)
      {
        <item>
          <title>@item.Title</title>
          <description>@item.Description</description>
          <link>@item.Url</link>
          <guid>@item.Id</guid>
          <pubDate>@item.PublicationDate</pubDate>
        </item>   
      }  
    </channel>
    </rss>
    

    However, you may want to consider a different approach: returning a result from your Controller Action that will generate the RSS directly. You can see examples of this approach in this blog post or described in this answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hibernate can auto-generate schemas from properly annotated POJO classes. And I also know that
Does anyone know a C# framework that can generate public/private keys, X.509 certificates and
I know that I can generate random floats with rand(max). I tried to generate
we know that we can generate EDMX model from sql server because EF support
I want to generate GUID strings in VBScript. I know that there's no built-in
I know that with Vista you can generate a dump file by goigg to
I have a XML schema, and I know that xsd.exe can generate the C#
I would like to have a class T that can generate only 1 instance
I know that it doesn't look like best practice but I need to generate
I want to know that does apple's Push Notification Server generate new device token

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.