ASP.NET核心禁用/删除特定的剃刀页
我有一个ASP.NET Core Razor页面项目,我已经实施了一系列剃须刀页面,其中一些页面,但目前我想“禁用 /删除它们”,以便用户不使用它们,作为一种功能标志。是否可以使用ex:属性或在启动中进行此类操作
[Disabled]
public abstract class MyPageModel : PageModel
{
// My code
}
,或者我必须从项目中删除它们? 谢谢
I have an Asp.Net Core Razor Pages project, I have implemented a series of razor pages, some of these but at the moment I would like to "disable / remove them" so that they are not usable by users, as a sort of feature flag. Is it possible to do this kind of thing with ex:
[Disabled]
public abstract class MyPageModel : PageModel
{
// My code
}
attributes or in the Startup.cs or do I have to remove them from the project?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
删除@page指令将显示与返回notfound()相同。但是,您可以在代码范围文件中指定此内容。这将使您可以将用户重定向到特定页面,例如一个人的主页
Removing the @page directive will display as the same as return NotFound(). However, you can specify this in the code-behind file. This would allow you to redirect the user to a specific page, e.g. one's homepage