无法调用我的自定义剃须刀页面 (HTTP 404)
Cannot call my custom razor page (HTTP 404)
我从头开始创建了一个新的 ASP.NET 核心 MVC 应用程序,并通过 "storing user accounts in-app" 进行身份验证。我用自己的自定义 VerifyEmail.cshtml
剃须刀页面扩展了 ASP 身份。
这看起来不错,不是吗?
但是我不能请求https://localhost:44345/Identity/Account/Manage/VerifyEmail,结果是404!
我忘记了什么?
这是 VerifyEmail.cshtml
:
@model VerifyEmailModel
@{
ViewData["Title"] = "Verify Email";
ViewData["ActivePage"] = ManageNavPages.VerifyEmail;
}
<h4>@ViewData["Title"]</h4>
<partial name="_StatusMessage" for="StatusMessage" />
<div class="row">
<div class="col-md-6">
<form method="post">
<div class="form-group">
<label asp-for="Email"></label>
<input asp-for="Email" class="form-control" disabled="disabled" />
</div>
<button id="email-verification" type="submit" class="btn btn-secondary">Send verification email</button>
</form>
</div>
</div>
在 VerifyEmail.cshtml
的第一行添加 @page
:
@page
@model VerifyEmailModel
@page
使文件成为 MVC 操作 - 这意味着它直接处理请求,而不通过控制器。 @page
必须是页面上的第一个 Razor 指令。 @page
影响其他 Razor 构造的行为。
我从头开始创建了一个新的 ASP.NET 核心 MVC 应用程序,并通过 "storing user accounts in-app" 进行身份验证。我用自己的自定义 VerifyEmail.cshtml
剃须刀页面扩展了 ASP 身份。
这看起来不错,不是吗?
但是我不能请求https://localhost:44345/Identity/Account/Manage/VerifyEmail,结果是404!
我忘记了什么?
这是 VerifyEmail.cshtml
:
@model VerifyEmailModel
@{
ViewData["Title"] = "Verify Email";
ViewData["ActivePage"] = ManageNavPages.VerifyEmail;
}
<h4>@ViewData["Title"]</h4>
<partial name="_StatusMessage" for="StatusMessage" />
<div class="row">
<div class="col-md-6">
<form method="post">
<div class="form-group">
<label asp-for="Email"></label>
<input asp-for="Email" class="form-control" disabled="disabled" />
</div>
<button id="email-verification" type="submit" class="btn btn-secondary">Send verification email</button>
</form>
</div>
</div>
在 VerifyEmail.cshtml
的第一行添加 @page
:
@page
@model VerifyEmailModel
@page
使文件成为 MVC 操作 - 这意味着它直接处理请求,而不通过控制器。 @page
必须是页面上的第一个 Razor 指令。 @page
影响其他 Razor 构造的行为。