I'm using Razor Pages and trying to access a property from ViewData:
@{
ViewData["Property"] = "Value";
}
I know this works:
<h1>@ViewData["Property"]
However, the app crashes when I try to access it with dot notation:
<h1>@ViewData.Property</h1>
Why does this hapen?
I know dot notation works with ViewBag since it allows me to access properties dynamically.