1

In DD4T 2.2 application, the URL value in PageController (public override ActionResult Page(string url)) is always coming as NULL. The RouteConfig is as below. Please suggest.

        routes.MapRoute(
            name: "TridionPage",
            url: "{*PageUrl}",
            defaults: new { controller = "Page", action = "Page" }
        );

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );

1 Answer 1

1

The placeholder variable (pageUrl) in the url mask of your route must match the parameter of your action method. It will most likely work if you change the signature of your action method to:

 public override ActionResult Page(string pageUrl)
3
  • @Quirjin No, It didnt work. Event its not hitting the PageController Page method. For example: abc.com works fine, but abc.com/index.html does not.
    – Thakur
    Commented Feb 3, 2020 at 15:42
  • That sounds like a different problem than before. You were saying earlier that the URL was 'always coming as null', now you say that some URLs work fine. To handle URLs ending with a file extension ('.html'), add runallmanagedmodulesforallrequests="true" to the modules element inside system.webServer. See for example luminowebdesign.no/tech-blogg/….
    – Quirijn
    Commented Feb 3, 2020 at 16:35
  • thanks a lot @Quirjin. That worked!!
    – Thakur
    Commented Feb 3, 2020 at 16:56

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.