Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Cédric Verstraeten 5 posts 25 karma points
    Nov 25, 2014 @ 12:58
    Cédric Verstraeten
    0

    MvcRenderController with Arguments

    I've been developing a news page using Umbraco 7. I strubbled on this page https://cultiv.nl/blog/whats-this-umbraco-route-hijacking-all-about/ and basically built exactly the same.

    Everythings is working and the hijacking is working properly, however I wanted to have some proper MVC routing, so for example I could pass arguments to the controller as well.

    So I would end up with something like this:

    namespace Cultiv.Controllers
    {
        public class BlogOverviewController : RenderMvcController
        {
            public ActionResult BlogOverview(BlogOverview model, string argument1)
            {
                if (model.Page == 0) // default value for int
                    model.Page = 1;
    
                // do paging 
    
                return CurrentTemplate(model);
            }
        }
    }
  • antao 81 posts 371 karma points
    Nov 25, 2014 @ 13:41
    antao
    0

    You can do that without any problems Cedric, just make sure pass the argument1 and the the asp.net mvc modelbinder will take care of the rest.

  • Cédric Verstraeten 5 posts 25 karma points
    Nov 25, 2014 @ 13:50
    Cédric Verstraeten
    0

    Hey antao, thank you for your answer. However the question isn't trivial I think. I have the feeling I will need to create a route for this, but that would make me bypass umbraco.

Please Sign in or register to post replies

Write your reply to:

Draft