I've been through a dozen blogs tonight looking for a solution for this problem. I am populating pages dynamically (shopping cart) and I grab the product name and descriptionfrom SQL Server then use that data to populate the page title, keywords and description meta tags. This is usually simple until you get a product with special characters. In this case and apostrophe ('). An apostrophe will display as expected in the <title> tag but in the meta tags I am gettimg the Html encoded equiv.
This is what I want: <meta name="keywords" content="3',5'-Mahogany" />
This is what I get: <meta name="keywords" content="3',5'-DIMETHOXY-4'-Mahogany" />
I tried HtmlDecode but it didn't work.
Here are a couple of other methods I have tried.
string prodName = (string)myData.GetProdName();
Page.Title = prodName;
Page.MetaKeywords = prodName;
Page.MetaDescription = prodName;
HtmlMeta kw = new HtmlMeta();
kw.HttpEquiv = "keywords";
kw.Content = String.Format("{0}", myData.GetProdName());
this.Header.Controls.Add(kw);
I'm hoping another set of eyes will solve this one :)
Thanks All!