You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
Add a property to be accessed from the page's CSHTML file: public string Message { get; set; } = "Hello";
Open the Index.cshtml page file
Attempt to render the value of Model.Message inside the "Scripts" section:
@section Scripts { <h1>@Model.Message</h1> }
Expected Result
The message is rendered in the HTML OK.
Actual Result
InvalidCastException: Unable to cast object of type 'Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1[System.Object]' to type 'Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1[WebApplication26.Pages.IndexModel]'.