Copied to clipboard

Flag this post as spam?

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


  • Benjamin Hopkins 1 post 71 karma points
    Jan 15, 2018 @ 16:37
    Benjamin Hopkins
    0

    Hijack Routing not working for anything other than index

    Hello,

    We are currently adding umbraco into an existing MVC site and have followed the hijack method to get the current pages working however it seems only the index method works. Other methods result in a 404.

    Any ideas? Should I move these into a surface controller?

    public class DocumentsController : Umbraco.Web.Mvc.RenderMvcController
    {
        public DocumentsController()
        {
    
        }
    
        public async Task<ActionResult> Index()
        {
          FileStorageModel fileStorageModel = new FileStorageModel(CurrentPage);
          return CurrentTemplate(fileStorageModel);
        } 
    
        [AcceptVerbs(HttpVerbs.Post)]
        public async Task<ActionResult> UploadDocuments(IEnumerable<HttpPostedFileBase> files, int userId, int parentFolderId, int userChoice)
        {
        ..... Cant hit this
        }
    }
    
  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Jan 16, 2018 @ 08:03
    David Brendel
    2

    Hi Benjamin,

    Route Hijacking only uses the default route for the document type that you hijacked which is the Index one. If you need additional routes you can register them in the RouteTable the normal MVC way. Keep in mind that there is also an extension method called MapUmbracoRoute to map Routes to "Nodes".

    Regards David

Please Sign in or register to post replies

Write your reply to:

Draft