The Razor view engine automatically differentiates between Server code and Html Code
For example this code works very fine
@if (DateTime.Now.Year == 1983)
{
if (DateTime.Now.Month == 9)
{
<p>Wow, this month Shay is born!</p>
}
}
else
{
<p>It's the new millenium dude!</p>
}
But if I want to show html tags or anchor tags in the text then what escape character should I use?
Like in the above example I want to show the else message like this
else
{
<p>It's the new <millenium> dude!</p>
}
You have to use
But that’s not a Razor issue, it’s HTML. If you want to display
<or>you have to use the HTML entities instead.