how to remove the meta tag named "Generator" which Sitefinity generates by default containing the version information?
I want to remove the meta tag "<meta name="Generator" content="Sitefinity 9.1.6110.0 SE ">" for which i have already implemented a solution by writing the following code chunk in the master page.
protected override void Render(HtmlTextWriter writer)
using (HtmlTextWriter htmlwriter = new HtmlTextWriter(new System.IO.StringWriter()))
base.Render(htmlwriter);
string html = htmlwriter.InnerWriter.ToString();
html = html.Replace("<
meta
name=\"Generator\" content=\"Sitefinity 8.0.5710.0 PE\" />", "");
writer.Write((html));
But someone suggested me that its not an appropriate solution because of In-memory rendering of entire page, the default masterpage renders the entire page to a string which incurs a performance overhead. If you want to remove headers, you can do so
on the ASP.NET Page object level. So i want an other solution of it as suggested can anyone give an other solution?
Hi Tabish,
I answered to your question at SO. Will repeat it here as well:
Best way to do that is subscribe to IPagePreRenderCompleteEvent event and remove this control. An example of global.asax code
protected void Application_Start(object sender, EventArgs e)
Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += Bootstrapper_Initialized;
protected void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs args)
if (args.CommandName == "Bootstrapped")
EventHub.Subscribe<
IPagePreRenderCompleteEvent
>(this.OnPagePreRenderCompleteEventHandler);
private void OnPagePreRenderCompleteEventHandler(IPagePreRenderCompleteEvent evt)
if (!evt.PageSiteNode.IsBackend)
var controls = evt.Page.Header.Controls;
System.Web.UI.Control generatorControl = null;
for(int i=0;i< evt.Page.Header.Controls.Count;i++)
var control = evt.Page.Header.Controls[i];
if ((control is HtmlMeta) && (control as HtmlMeta).Name == "Generator")
generatorControl = control;
evt.Page.Header.Controls.Remove(generatorControl);