Determine if user can access the requested page?

后端 未结 7 1404
小鲜肉
小鲜肉 2021-01-05 10:36

I have an ASP.Net website with multiple roles, each with access to a separate directory (i.e. admin users can access /admin, shoppers can access /shop etc), using a shared l

相关标签:
7条回答
  • 2021-01-05 11:39

    Well, why don't you catch the directory in the login page? If the login page can determine which directory the user is trying to access, maybe they can get redirect to the right page based on role. If someone tries to go to /admin, and authentication succeeds, you can check if they do have access there. If not, you can either redirect to basic landing page indicating they do not have access or you redirect them to the role's landing page.

    EDIT: You could probably do the redirecting in the LoggedIn event of the control.

    0 讨论(0)
提交回复
热议问题