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

  • SEARCH
  • Home
  • 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 8742585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:31:44+00:00 2026-06-13T11:31:44+00:00

Pretty basic question but I cant seem to find it in the documentation. I’ve

  • 0

Pretty basic question but I cant seem to find it in the documentation. I’ve been integrating RestfulRouting (via nuget) into an Mvc 4 app but there are situations where it would be nice to tweak the the params, either change the name or have more than one argument into the controller action.

e.g.

/resource/:id/:slug

public ActionResult Show(int id, string slug) { return View(); }

or

/resource/:custom_param_name

public ActionResult Show(string custom_param_name) { return View(); }

Is there an example or documentation that covers this scenario?

  • 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-13T11:31:45+00:00Added an answer on June 13, 2026 at 11:31 am

    If i understand right you are trying to Route by name, not by id. with RestfulRouting.

    I’m no sure if it’s 100% possible, but you can try Create Custom Routes:

    Two additional methods are provided so you can add custom routes to the route set if you need to. Map is a chainable method that allows you to add standard mappings. Route is a method that will allow you to add a custom route to the route set.

    e.g.

    Map("posts/{year}/{slug}")
      .To<PostsController>(x => x.Post(-1, ""))
      .Constrain("slug", @"\w+")
      .Constrain("year", @"\d+");
    Route(new Route("posts/{action}", 
      new RouteValueDictionary(new { controller = "posts" }), 
      new MvcRouteHandler());
    

    or

    Map("resource/{custom_param}")
      .To<ResourcesController>(x => x.Resource(-1, ""))
      .Constrain("custom_param", @"\w+");
    Route(new Route("resource/custom", 
      new RouteValueDictionary(new { controller = "resource" }), 
      new MvcRouteHandler());
    

    So you can use:

    public ActionResult Custom(string custom_param) { return View(); }
    

    How to use it ?

    public class Routes : RouteSet
    {
        public override void Map(Mapper map)
        {
            map.Root<HomeController>(x => x.Show());
            map.Path("test/{id}").To<TestController>(x => x.Test()).Constrain("id", @"\d+");
            map.Resource<SessionsController>();
            map.Resources<BlogsController>(blogs =>
            {
                blogs.As("weblogs");
                blogs.Only("index", "show");
                blogs.Collection(x => {
                    x.Get("latest");
                    x.Post("someaction");
                );
                blogs.Member(x => x.Put("move"));
    
                blogs.Resources<PostsController>(posts =>
                {
                    posts.Except("create", "update", "destroy");
                    posts.Resources<CommentsController>(c => c.Except("destroy"));
                });
            });
        }
    }
    
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RestfulRoutingViewEngine());
    
            RouteTable.Routes.MapRoutes<Routes>();
        }
    }
    

    How to use: Restful Routing for ASP .NET MVC

    Full guide for this can be found here: RestfulRouting

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

Sidebar

Related Questions

This is a pretty basic question, but I can't seem to find it. It
this is a pretty basic question but I can't seem to get it right.
This is a pretty basic question but I can't find a good answer for
I'm pretty sure this is a basic question, but I can't find the answer
Question is probably pretty basic, but can't find out what's wrong (and it leads
This is a pretty basic question, but I've been working at it for a
this is probably a pretty basic question but I can't seem to get OpenGL
Pretty basic question but I couldn't find a solution through google. In QT when
Pretty basic Rails question I assume but I can't figure out the simplicity of
I think this is a pretty basic question, but after Googling around I can't

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.