ASP.NET 4 MetaKeywords and MetaDescription being Encoded
I'm using the ASP.NET 4 MetaKeywords
and MetaDescription
on every page to set the appropriate meta tags. I also use the Anti XSS Library as the default encoder in the application.
The tags end up being rendered like:
<meta n开发者_如何学Goame="description" content="Test description" />
<meta name="keywords" content="my meta, tags, encoded, why" />
The AntiXssLibrary
is set to default in web.config
as below:
<httpRuntime encoderType="AntiXssEncoder, MyClassLib"/>
Is there an issue with them being encoded this way, and is there any way I can get rid of this encoding?
It shouldn't cause a problem - the encoding is correct. I don't know of any web crawlers that won't understand it. You can't get rid of it I'm afraid - what's happening there is that HtmlAttributeEncoding is being called, and that's designed to be safe for name/id fields, where spaces should be encoded. AntiXSS is a bit stricter than the default ASP.NET encoders by design.
精彩评论