The module containts of a bunch of string properties like:
Public Module RolRechten
Private ReadOnly _DienstenRecht = "Beheer diensten"
Public ReadOnly Property Di开发者_如何学GoenstenRecht() As Object
Get
Return _DienstenRecht
End Get
End Property
how do you acces this module in your view ?
If Page.User.IsInRole("Beheer diensten") Then
The goal is to prevent typo's all around the application and if someone for some unknown reason wants to change the description of a role we don't have to check every if.
You could import the namespace and then use it:
@Imports AppName
@Code
If User.IsInRole(RolRechten.DienstenRecht) Then
End If
End Code
Also notice that I am using User.IsInRole
. Page.User.IsInRole
is classic web forms and chances are it will crash in Razor.
精彩评论