Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的网络系统中创建了不同的角色(例如管理员、活动用户、用户……)。用户通过内置 ASP 进行身份验证:登录后,我为不同的用户角色设置了不同的文件夹。 任何用户组都有一个文件夹和 Web 配置页面,以允许或拒绝访问该文件夹的页面。 现在我的问题是: 如何将用户从无权查看的页面重定向到另一个页面,如访问拒绝.aspx 页面? 有关更多信息:我希望当“用户”单击经理页面时,它会重定向到访问 denied.aspx 页面。 注意: 如果退出不显示用户组管理员页面的方式,请说出来。
把它放在母版页中
if (!(HttpContext.Current.User.IsInRole("Admin"))) { Response.Redirect("UnAuthenticatedUser.aspx"); }
在经理的页面加载中:
if (!User.IsInRole("managers")) { Response.redirect("denied.aspx") }
或类似的东西?