Microsoft Content Management Server - Re: CMS Inserting Extra <Base> Tag in Header? Breaking our pages on IE

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > December 2006 > Re: CMS Inserting Extra <Base> Tag in Header? Breaking our pages on IE





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: CMS Inserting Extra <Base> Tag in Header? Breaking our pages on IE
markcz

2006-12-12, 7:26 pm

Hallo all,
well, Stefan's solution is of course better I thought this is the
only way
regards, Martin

markcz napsal:[vbcol=seagreen]
> Hallo Ninerfan,
> Base metatag is inserted By RobotMetatag CMS control, to override
> default behaviour create your own where you could not write your base
> tag. But, this is by default for override paths used by cms and I am
> not sure everything will work then.
> You need to include your control on all your pages.
>
> bye, Martin
>
> Here is our custom robotmetatag:
>
>
> using Microsoft.ContentManagement.WebControls;
> using Microsoft.ContentManagement.Common;
> using Microsoft.ContentManagement.Publishing;
>
> namespace MDCRInternet.CMSExtensionPack.UserControls
> {
> using System;
> using System.Data;
> using System.Drawing;
> using System.Web;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Web.UI.HtmlControls;
>
> /// <summary>
> /// Summary description for W3CRobotMetatag.
> /// </summary>
> public partial class W3CRobotMetatag : UserControl
> {
> private bool renderBaseHref = true;
> private const string Index = "INDEX";
> private const string Follow = "FOLLOW";
> private const string noIndex = "NOINDEX";
> private const string noFollow = "NOFOLLOW";
>
> public W3CRobotMetatag()
> {
> }
>
> public bool RenderBaseHref
> {
> get { return this.renderBaseHref; }
> set { this.renderBaseHref = value; }
> }
>
> protected override void Render(System.Web.UI.HtmlTextWriter writer)
> {
> ChannelItem currentItem = CmsHttpContext.Current.ChannelItem;
>
> if( currentItem != null )
> {
> string followKey = (currentItem.IsRobotFollowable)?Follow:noFollow;
> string indexKey = (currentItem.IsRobotIndexable)?Index:noIndex;
>
> // write out robot meta tag
> writer.Write("<META name=\"ROBOTS\"
> content=\""+followKey+","+indexKey+"\" >\n");
>
> if( this.RenderBaseHref )
> {
> string urlString = Server.HtmlEncode(
> Page.Request.Url.AbsoluteUri);
> writer.Write("<BASE href=\""+ urlString+"\" >");
> }
> }
>
>
> }
>
> #region Web Form Designer generated code
> override protected void OnInit(EventArgs e)
> {
> //
> // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> //
> InitializeComponent();
> base.OnInit(e);
> }
>
> /// <summary>
> /// Required method for Designer support - do not modify
> /// the contents of this method with the code editor.
> /// </summary>
> private void InitializeComponent()
> {
> //this.Load += new System.EventHandler(this.Page_Load);
> //this.rptProgrammArchive.ItemDataBound += new
> System.Web.UI.WebControls.RepeaterItemEventHandler(this.Repeater_ItemDataBound
> );
> }
> #endregion
>
> }
>
> }
>
>
> Ninerfan napsal:

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com