Currently i'm working in one migration request, where we need to change the framework from 3.5 to 4.6.2. Here the problem is after changing the framework below method is not showing result as expected.
My.User.IsInRole() is returning null.
Could anyone please suggest equivalent code for the above or please suggest steps to resolve the issue in my Visual Studio.
Earlier I faced problem with My.User.Name and changed the code to Environment.Username but for this I am unable to find some alternate method.
My.User.IsInRole()should not returnnull/Nothing. The return value is aBoolean.As an alternative you can use
System.Security.PrincipalNamespace like in the following example:But this should return the same result: