aspnetcore/samples/CustomPolicyProvider/Views/Home/MinimumAge.cshtml

22 lines
503 B
Plaintext

@using System.Security.Claims
@model int
@{
var dateOfBirth = User.FindFirst(c => c.Type == ClaimTypes.DateOfBirth)?.Value;
}
<!-- Welcome user and display DateOfBirth claim value -->
<h1>Welcome, @User.Identity.Name</h1>
<h2>Welcome to a page restricted to users @Model or older</h2>
<p>
You can access this page since you were born on @dateOfBirth.
</p>
<ul>
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("Sign Out", "Signout", "Account")</li>
</ul>