开发者

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&#32;description" />
<meta name="keywords" content="my&#32;meta,&#32;tags,&#32;encoded,&#32;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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜