hi all I am practising on MCAD training kit book
and heres an example I tried but gave me an exception
specified cast is not valid
and heres the code as an example in my book
and heres an example I tried but gave me an exception
specified cast is not valid
and heres the code as an example in my book
Code:
This example assumes that the Principal policy has been set to
WindowsPrincipal.
Dim myPrincipal As WindowsPrincipal
Gets a reference to the current WindowsPrincipal
myPrincipal = CType(Threading.Thread.CurrentPrincipal, _
WindowsPrincipal)
Dim myIdentity As WindowsIdentity
Gets the WindowsIdentity of the current principal
myIdentity = CType(myPrincipal.Identity, WindowsIdentity)
Displays the username of the current user
MessageBox.Show(myIdentity.Name)