Advertisement
Guest User

Untitled

a guest
May 28th, 2018
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. RouteConfig.cs file
  2.  
  3. routes.MapRoute(
  4. name: "TridionPage",
  5. url: "{*PageUrl}",
  6. defaults: new { controller = "Page", action = "Page" }
  7. );
  8. routes.MapRoute(
  9. name: "Default",
  10. url: "{controller}/{action}/{id}",
  11. defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
  12. );
  13.  
  14.  
  15. Global.ascx.cs
  16.  
  17. public class MvcApplication : System.Web.HttpApplication
  18. {
  19. ILifetimeScope BuildContainer()
  20. {
  21. var builder = new ContainerBuilder();
  22. builder.RegisterControllers(typeof(MvcApplication).Assembly);
  23. builder.UseDD4T();
  24. return builder.Build();
  25. }
  26. protected void Application_Start()
  27. {
  28. var builder = BuildContainer();
  29. DependencyResolver.SetResolver(new AutofacDependencyResolver(builder));
  30.  
  31. AreaRegistration.RegisterAllAreas();
  32. RouteConfig.RegisterRoutes(RouteTable.Routes);
  33. }
  34. }
  35.  
  36. Page Controller File
  37.  
  38. public class PageController : TridionControllerBase
  39. {
  40. public PageController(IPageFactory pageFactor,
  41. IComponentPresentationFactory componentPresentationFactory,
  42. ILogger logger,
  43. IDD4TConfiguration configuration) :
  44. base(pageFactor, componentPresentationFactory, logger, configuration)
  45. {
  46.  
  47. public override ActionResult Page(string url)
  48. {
  49. return base.Page(url);
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement