I've added some of my own helpers to the System.Web.Mvc within my project and got it working with the default asp.net mvc view engine. By defining the helper like
namespace System.Web.Mvc
{
public static class XSSHelper
{
public static string h(this HtmlHelper helper, string input)
{
return AntiXss.HtmlEncode(input);
}
public static string Sanitize(this HtmlHelper helper, string input)
{
return AntiXss.GetSafeHtml(input);
}
public static string hscript(this HtmlHelper helper, string input)
{
return AntiXss.JavaScriptEncode(input);
}
}
}
I called it using <%= Html.h("<h1>some string</h1>") %>
Now that I am using the spark view engine I cannot seem to get this to work. I receive the following error:
'System.Web.Mvc.HtmlHelper' does not contain a definition for 'h' and no extension method 'h' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)'
How can I get Spark to see the additional helpers?
EDIT: I've also added _global.spark with <using namespace="myApp" />
to no avail