More in this section

Forums / General Discussions / How customize 'Thank you for visiting our web site.' Page

How customize 'Thank you for visiting our web site.' Page

2 posts, 0 answered
  1. Vincent
    Vincent avatar
    41 posts
    21 Sep 2007
    24 Dec 2010
    Link to this post
    I would like to know if I can redirect to a static html page when the site is showing 'Thank you for visiting our web site.' This happens to anonymous users because I have restricted all pages access to backendusers.
    Thank you
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    24 Dec 2010
    Link to this post
    Hi Vincent,

    Currently it is hard to redirect from the under construction page. We need to implement 403 response when someone tries to access a page with no permissions, but now you get page not found and you are redirected to the under construction page.

    To change the under construction page you can try the following

    1. Crate a new class that inherits from SitefinityRoute.
    2. Override GetRouteData and before calling the base check the current request and return

    var siteMapProvider = SitefinitySiteMap.GetCurrentProvider();
    string virtualPath = httpContext.Request.AppRelativeCurrentExecutionFilePath.Substring(2) + httpContext.Request.PathInfo;
    var unresolvedPath = ObjectFactory.Resolve<UrlLocalizationService>().UnResolveUrlAndApplyDetectedCultures(virtualPath);
      var node = siteMapProvider.FindSiteMapNode(unresolvedPath);
    if(node == null)
     return new RouteData(this, new UnderConstructionRouteHandlerCustom());

    3. Create a custom class UnderConstructionRouteHandlerCustom that inherits from UnderConstructionRouteHandler and there override GetTemplateInfo where you can return your custom template

    4. Finally initialize your custom route

    protected void Application_Start(object sender, EventArgs e)
               Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(this.AfterInit);
           private void AfterInit(object sender, ExecutedEventArgs args)
               RouteCollection c = new RouteCollection();
               c.Add("Frontend", ObjectFactory.Resolve<SitefinityRouteCustom>());      

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered