ASP.NET MVC2 拒绝使用 IIS 7 访问控制器?
我有一个名为 admin 的目录。 该目录没有物理路径,因为它被硬编码为我的管理区域的前缀。
如何通过标准认证来保护这条路径? 我希望只有管理员用户才能登录该区域。 但主页需要对每个用户都可用。
I have a directory that is named admin.
There is no physical path to this directory, as it is hard-coded as prefix for my administration area.
How can I protect this path with standard-authentification?
I want that only user Admin can login to that area.
But the main page needs to be available for every user.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用任何内置身份验证变体:
编辑
要限制为特定用户:
编辑2
是的,您可以,但这有点黑客攻击。创建您自己的类并从
RouteBase
派生它。然后将其添加到您的 global.asax 中。
If you are using any of the built in authentication variants:
Edit
To limit to a specific user:
Edit2
Yes you can, but it's kind of a hack. Create your own class and derive it from
RouteBase
.Then add it in your global.asax.