How to stop Spark View Engine HTML encoding?
Even with the following in spark section of web.config:
<pages automatic开发者_开发百科Encoding="false">
Things between ${...} Still get passed through H(...), which HTML encodes it.
How change this or should I just fall back to !{...}?
You can change Spark's default using its configuration, though I would recommend you use ${} when you want encoded HTML and !{} when you don't.
Spark can be configured from either Web.config or using a SparkSettings instance.
In Web.config, under your <spark> configuration, add:
<pages automaticEncoding="false">
You'll want to make sure you only have the one <pages/> element. I'm unsure if Spark's processor will raise an error if you have multiple.
Using SparkSettings, add:
SparkSettings settings = new SparkSettings()
.SetAutomaticEncoding(false);
If you have these settings and still get automatic encoding, set a break-point at the point where you instantiate your SparkViewFactory (or use Console.WriteLine() or your logging framework) and have a look at:
mySparkViewFactory.Settings.AutomaticEncoding
加载中,请稍侯......
精彩评论