I am trying to use a Razor template to produce a .aspx page as output. I’m not having luck looking in the documentation for how to do this. The Page and namespace declarations are breaking the template:
<%@ Page Language="C#" Title="@Page.Metadata.browser_title" %>
<%@ Import Namespace="System.Xml" %>
These are causing this error:
TemplateCompileException: CS1501: No overload for method ‘Write’ takes 0 arguments Line 27 Column 1: Write();
I assume this is because Razor templates using C# syntax makes the two conflict, since the declarations above use “@”. Is there a way to get them to work together so a Razor template can produce an output with C# in the rendered product after the template is run? The example above also shows how the value for “Title” needs to be rendered out of the template.
The
@s in the<%are invalid Razor syntax.You need to escape them by writing
<%@@.