Task: Remove extra new line from dynamically created title tag
Description: Remove extra new line from dynamically created title tag. As previously we created Title tag (Title of page) using code (Link) for SEO purpose. There is a little issue with Title tag, It takes extra new line but in SEO we want to remove this new line. we can use this in Master Page so that we needn't to rewrite it for every page.
Description: Remove extra new line from dynamically created title tag. As previously we created Title tag (Title of page) using code (Link) for SEO purpose. There is a little issue with Title tag, It takes extra new line but in SEO we want to remove this new line. we can use this in Master Page so that we needn't to rewrite it for every page.
using
System.Reflection;
public static void
InitializeTitleTag()
{
Type
type = typeof(HtmlTextWriter);
FieldInfo
field = type.GetField("_tagNameLookupArray",
BindingFlags.Static | BindingFlags.NonPublic);
Array
lookup = (Array)field.GetValue(null);
int index =
(int)HtmlTextWriterTag.Title;
object
value = lookup.GetValue(index);
type = value.GetType();
field = type.GetField("tagType");
field.SetValue(value, 0);
lookup.SetValue(value, index);
}