Skip to content

Unable to compile template. The name 'Url' does not exist in the current context #188

@aolmez

Description

@aolmez

I am using RazorEngine to render out some basic content. It works great until I include any @url syntax into markup.

If the markup contains an @url I get the following error

Unable to compile template. The name 'Url' does not exist in the current context

Other compilation errors may have occurred. Check the Errors property for more information.

template = "Hello @Model.Name! @Url.Action("Preview", "Topics") Welcome to Razor!";
string result = RazorEngine.Razor.Parse(template, new { Name = "World" });

What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions