8

Even with the following in spark section of web.config:

<pages automaticEncoding="false">

Things between ${...} Still get passed through H(...), which HTML encodes it.

How change this or should I just fall back to !{...}?

zero323
  • 322,348
  • 103
  • 959
  • 935
Norbert B.
  • 5,650
  • 3
  • 25
  • 30

1 Answers1

8

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
Tom Mayfield
  • 6,235
  • 2
  • 32
  • 43