How can I create a view that has different displays according to the role the user is in?

后端 未结 8 1373
南方客
南方客 2020-12-04 11:22

I want to create a view that has different displays according to the role the user is in.

Should I create a different view for different roles or should I check the

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 12:11

    Yeah that was something that was bothering me as well ... but at the same time it seems ridiculous to load whole different view for such a small change.

    btw how did you set this up in your controller. Right now, my controller looks something like the code below, which I don't think is correct.

    [Authorize(Roles = "Admin, Member")]
    public ActionResult RegistrationInformation()
    {
    
        return View();
    }
    

提交回复
热议问题