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

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)
| improve this answer | |
  • @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 Feb 3 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 Feb 3 at 16:35
  • thanks a lot @Quirjin. That worked!! – Thakur Feb 3 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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