Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

ClaimsPrincipal.Current declaration in VB.NET

$
0
0

Hello,

I am using a code in C# that works fine for a website designed in C# but I am uable to convert it to VB.NET for another site. Here is the C# functional code:

using System.Security.Claims;
dynamic principal = ClaimsPrincipal.Current;

Then I could do principal.FindFirst(ClaimTypes, givename, email etc... Whatever I need to fetch from AD.

So I tried to convert it to VB.NET like this

Imports System.Security.Claims
Dim principal As VariantType = ClaimsPrincipal.Current


But it gives me System.Security.IPrincipal implementation that supports multiple claims based identities. Value of type ClaimsPrincipal cannot be converted to VariantType.

Does someone know what would be correct VB.NET syntax for the line below to get the current logged in user?

Dim principal As VariantType = ClaimsPrincipal.Current

Thanks


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>