Skip to content

Razor page not escaping @ in attributes #38595

@Muchiachio

Description

@Muchiachio

Trying to escape @ in razor's html attribute results in two @@ being written. Using single @ doesn't work either, because it switches back to C# context.

Example

@{
    string domain = "com";
}

<author mail-domain="@@company.@domain">John Freyman</author>

Expected

<author mail-domain="@company.com">John Freyman</author>

Actual

<author mail-domain="@@company.com">John Freyman</author>

Workaround

@{
    string domain = "com";
}

<author mail-domain="@("@")company.@domain">John Freyman</author>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue describes a behavior which is not expected - a bug.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions