0

I am having a problem and I can't find a solution.

I have a module with some extension methods for IPrincipal:

<System.Runtime.CompilerServices.Extension()> _
Public Function CanCallGhostbusters(ByRef activeUser As IPrincipal) As Boolean
    Dim result As Boolean = False

    resultado = activeUser.IsInRole("GB\GhostBustersCaller") AndAlso ...

    Return result
End Function

The code is working fine in .aspx pages:

Protected Sub Page_Load(ByVal s As Object, ByVal e As System.EventArgs) Handles Me.Load
    If User.CanCallGhostbusters Then
        //It works; cool!
    End If
End Sub

But it is not working in the masterpage; the extension method doesn't appear in the intellisense. I have tried:

If HttpContext.Current.User.CanCallGhostbusters  Then
    //Error: CanCallGhostbusters is not a member of System.Security.Principal.IPrincipal
End If

Dim activeUser As System.Security.Principal.IPrincipal = HttpContext.Current.User
If activeUser.CanCallGhostbusters Then
    //Error: CanCallGhostbusters is not a member of System.Security.Principal.IPrincipal
End If

Any idea?

Thanks!

0 Answers0