重定向到“区域”部分下的页面时出错
Error redirecting to page under Areas section
我的 Areas 部分下有一个 Index.cshtml Razor 页面。
我正在尝试使用以下代码重定向到该页面。
return RedirectToPage("/Index", new { area = BusinessType.Storage });
但这会产生错误。
An unhandled exception occurred while processing the request.
InvalidOperationException: No page named '/Index' matches the supplied values.
Microsoft.AspNetCore.Mvc.Infrastructure.RedirectToPageResultExecutor.ExecuteAsync(ActionContext context, RedirectToPageResult result)
我不太明白这个错误,或者为什么我的重定向不起作用。
尝试设置断点检查BusinessType.Storage
,问题可能与此有关。
此外,尝试使用以下代码:
return RedirectToPage("/Index", new { area = "Storage" });
我的 Areas 部分下有一个 Index.cshtml Razor 页面。
我正在尝试使用以下代码重定向到该页面。
return RedirectToPage("/Index", new { area = BusinessType.Storage });
但这会产生错误。
An unhandled exception occurred while processing the request.
InvalidOperationException: No page named '/Index' matches the supplied values.
Microsoft.AspNetCore.Mvc.Infrastructure.RedirectToPageResultExecutor.ExecuteAsync(ActionContext context, RedirectToPageResult result)
我不太明白这个错误,或者为什么我的重定向不起作用。
尝试设置断点检查BusinessType.Storage
,问题可能与此有关。
此外,尝试使用以下代码:
return RedirectToPage("/Index", new { area = "Storage" });