asp.net mvc - Testing user role , Authorize attribute in VB.NET -


I am using ASP.NET MVC to create a site. I am using VB as a programming language. I have some questions.

1 I have created a role "Manager" How should I check that the user belongs to this particular role?

For now I'm using

  if My.User.IsInRole ("Manager") then 'see another option for direct one other view Is this the right way?  

How to use the authorized attribute to restrict access to 2 functions?

I know that in C # this happens [authorized (roles = "manager")] but not sure in VB

besides , I can define that user to redirect, at which point there is no "manager" role for a particular view while trying to access this function.

Thanks in advance.

This will be in VB:

  & lt; Authorized (roles: = "manager") & gt; _  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -