+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / SF Version meta tag

SF Version meta tag

7 posts, 0 answered
  1. Jodie
    Jodie avatar
    27 posts
    Registered:
    28 May 2009
    09 Dec 2009
    Link to this post
    Urro,

    Is there a way to remove or reduce the meta tag SF inserts into the header?

    It show's the full version, (3.7.2028.2:3 in our case)

    I'd prefer it wasn't there at all, but showing a partial version (3.x) or just the attirbution would be OK.

    (This is a licensed install, not the community edition)

    Cheers, Me.

  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    09 Dec 2009
    Link to this post
    Hello Chris,

    Unfortunately we haven't designed this tag to be removed. Is there any specific reasons why you do not want it?


    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Jodie
    Jodie avatar
    27 posts
    Registered:
    28 May 2009
    09 Dec 2009
    Link to this post
    Security 101:

    Don't expose detailed version information to the public internet.


  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    09 Dec 2009
    Link to this post
    Hello Chris,

    I regret to inform you that the version tag cannot be removed. We will consider possible option in the backend of Sitefinity 4.0 to control this.


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Jodie
    Jodie avatar
    27 posts
    Registered:
    28 May 2009
    09 Dec 2009
    Link to this post
    OK...

    Changing it to something like:

    <meta name="Generator" content="Sitefinity 3" />
    Would be more sensible, and would keep the attribution if that's important for telerik.

    Cheers, Chris H.

  6. Anton Mernov
    Anton Mernov avatar
    110 posts
    Registered:
    03 Dec 2008
    10 Dec 2009
    Link to this post
    Hi Chris,

    My workaround is:
    1. Open ~/Sitefinity/cmsentrypoint.aspx and replace
    <%@ Page Inherits="Telerik.Cms.Web.InternalPage" MasterPageFile="~/Sitefinity/Dummy.master" %> 
    on
    <%@ Page Inherits="CustomPage" MasterPageFile="~/Sitefinity/Dummy.master" %> 

    2. Create in ~/App_Code folder CustomPage.cs:
    using System; 
    using System.IO; 
    using System.Data; 
    using System.Configuration; 
    using System.Web; 
    using System.Web.Security; 
    using System.Web.UI; 
    using System.Web.UI.HtmlControls; 
    using System.Web.UI.WebControls; 
    using System.Web.UI.WebControls.WebParts; 
    using System.Text.RegularExpressions; 
     
     
    public class CustomPage : Telerik.Cms.Web.InternalPage 
        protected override void Render(HtmlTextWriter writer) 
        { 
            HtmlTextWriter output = new HtmlTextWriter(new StringWriter()); 
            base.Render(output); 
     
            string outputString = outputString.Replace("<meta name=\"Generator\" content=\"Sitefinity 3.6.1936.2:0\" />", ""); 
            writer.Write(outputString); 
        } 
    }  
     

    Please note that Sitefinity version, for example Sitefinity 3.6.1936.2:0 in code above, must be changed manually
    at each upgrade.

    I hope this helps.

    Best regards,
    Anton.
  7. OregonTech
    OregonTech avatar
    9 posts
    Registered:
    08 Jan 2009
    21 Jan 2011
    Link to this post
    The solution that I came up with is to use a control adapter to completely remove this tag.

    1. Create a new code file in your site project (in App_Code if it's a website project, otherwise wherever you store your code files if it's a web application project).  I called mine MetaGeneratorAdapter.cs

    2. Add the following code to the MetaGeneratorAdapter.cs file:
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
     
    namespace Website
    {
        public class MetaGeneratorAdapter : System.Web.UI.Adapters.ControlAdapter
        {
            protected override void Render(HtmlTextWriter writer)
            {
                HtmlMeta metaTag = (HtmlMeta)this.Control;
                if (metaTag.Name == "Generator")
                {
                    return;
                }
                else
                {
                    base.Render(writer);
                }
            }
        }
    }

    3.  If you don't have an App_Browsers folder in your project, create one and add a new browser file to it called something like Adapters.browser, although it can be named anything as long as it has the .browser extension.

    4.  Add the following to the .browser file just created:
    <?xml version='1.0' encoding='utf-8'?>
    <browsers>
      <browser refID="Default">
        <controlAdapters>
          <adapter controlType="System.Web.UI.HtmlControls.HtmlMeta" adapterType="Website.MetaGeneratorAdapter" />
        </controlAdapters>
      </browser>
    </browsers>

    That's it, the generator meta tag is now completely removed when your pages are rendered.

    Alan
Register for webinar
7 posts, 0 answered