More in this section

Forums / Developing with Sitefinity / CmsContext.IsRequestCrawler 4.x equivalent

CmsContext.IsRequestCrawler 4.x equivalent

2 posts, 1 answered
  1. Jon Ingersoll
    Jon Ingersoll avatar
    32 posts
    12 May 2009
    11 May 2011
    Link to this post
    Good Morning,

    We are currently in the process of our 4.x upgrade and are updating our custom usercontrols. For many of our controls we wrap the functionality in a !CmsContext.IsRequestCrawler(this.Context) check. We've found that without this, the search index in sitefinity takes a very long time as the controls do not load correctly when the crawler hits them and then has to wait while the error is generated. By disabling them for the search index, everything runs much smoother.

    We've been reviewing the 4.x api, but cannot find the equivalent method to check for crawler. Any suggestions on where to look?

  2. Ivan Pelovski
    Ivan Pelovski avatar
    43 posts
    24 Sep 2012
    13 May 2011
    Link to this post
    Hi Jon Ingersoll,

    There are several utility extension methods defined in System.Web.UI.ControlExtensions class and are used throughout Sitefinity. The method you can use is:
    /// <summary>
    /// Determines whether this control is rendered by the search engine (and this has to render partially/differently)
    /// </summary>
    /// <param name="control">Control to test</param>
    /// <returns>True if the control should take special action during the rendering stage while being indexed, or false otherwise</returns>
    public static IndexRenderModes GetIndexRenderMode(this Control control)

    You can use this piece of code inside your control:
    protected override void Render(HtmlTextWriter writer)
        var indexRenderMode = this.GetIndexRenderMode();
        if (indexRenderMode == IndexRenderModes.Normal)

    Ivan Pelovski
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested 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, 1 answered