w pliku index.cshtml:
@page
@model NeonMvc.Views.Home.IndexModel
@{
}
<div class="text-center text-info">
<p>@ViewData["Message"]</p>
</div>
w pliku index.cshtml.cs:
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Authorization;
namespace NeonMvc.Views.Home
{
[AllowAnonymous]
public class IndexModel : PageModel
{
[ViewData]
public string Title { get; set; }
public string Message { get; set; }
public void OnGet()
{
Title = "HomePage";
Message = "strona startowa tutaj";
}
}
}
i dla czego ten error po odpaleniu strony: "NullReferenceException: Object reference not set to an instance of an object." ???