|
Listing 6-15 extracted from chapter
Security
Listing 6-14< > Listing 6-16
This listing can be compiled with the command line: csc.exe /target:exe Example_6_15.cs Errors: 0 Warnings: 0
Example_6_15.cs
using System;
using System.Security.Principal;
class Program{
static void Main(){
System.AppDomain.CurrentDomain.SetPrincipalPolicy(
PrincipalPolicy.WindowsPrincipal);
IPrincipal pr = System.Threading.Thread.CurrentPrincipal;
IIdentity id = pr.Identity;
Console.WriteLine( "Name : " + id.Name );
Console.WriteLine( "Athenticated? : " + id.IsAuthenticated );
Console.WriteLine( "Authentification type : "+id.AuthenticationType);
}
}
Copyright Patrick Smacchia 2006 2007
|