You work as a Software Developer for ABC Inc. You use Visual Studio .NET to develop a Windows application named MyWindowApp. You implement the security classes of the .NET Framework. When users interact with the application, the role-based validation should perform frequently. You must ensure that only validated Windows NT or Windows 2000 domain users are permitted to access the application. You add the appropriate Imports statements for the System.Security.Principal namespace and the System.Threading namespace.
Which of the following code segments will you use to accomplish this task?
A . Dim identity As WindowsIdentity = _WindowsIdentity.GetAnonymous()
Dim myprincipal As New WindowsPrincipal(identity)
B . AppDomain.CurrentDomain.SetThreadPrincipal(_ PrincipalPolicy.WindowsPrincipal)
Dim myprincipal As WindowsPrincipal = _CType(Thread.CurrentPrincipal, WindowsPrincipal)
C . Dim identity As WindowsIdentity = WindowsIdentity.GetCurrent()
Dim myprincipal As New WindowsPrincipal(identity)
D . AppDomian.CurrentDomain.SetPrincipalPolicy(_
PrincipalPolicy.WindowsPrincipal)
Dim myprincipal As WindowsPrincipal = _CType(Thread.CurrentPrincipal, WindowsPrincipal)
Answer: D