0
routes.MapRoute(
            name: "Rss",
            url: "{controller}/{action}/{SourceSite}/{Name}",
            defaults: new { controller = "RssController", action = "Index", SourceSite = UrlParameter.Optional, Name = UrlParameter.Optional }
        );

public class RssController : Controller
{
    // GET: Rss
    public ActionResult Index(string SourceSite, string Name)
    {
        string Url = NewsResourses.common.Single(p => p.SourceSite == SourceSite & p.Name == Name).Url;
        var rssItems = GetItemsFromChannel(Url);
        ViewBag.SourceName = Name;
        return View(rssItems);
    }

but when i am trying to get something like localhost:port/RssController/Index/Ria/Politics i get a 404 http exception.

Can you help me please?

2
  • Your url shouldn't contain 'controller' more like this : localhost:4000/rss/index Commented Mar 15, 2016 at 14:21
  • Ok, thank you. Thats work :) Commented Mar 15, 2016 at 14:37

2 Answers 2

2

You shouldn't need to specify the Controller part of the control name. Try the below:

defaults: new { controller = "Rss", action = "Index", SourceSite = UrlParameter.Optional, Name = UrlParameter.Optional }
Sign up to request clarification or add additional context in comments.

Comments

0

This is what you need to do:

localhost:port/Rss/Index/Ria/Politics

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.