code_junkie

DirectoryEntry.NativeObject throws access denied for a user in Administrators group in windows 2008

Nov 12th, 2011
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. using System;
  2. using System.DirectoryServices;
  3.  
  4. namespace nanttest
  5. {
  6. class Program
  7. {
  8. public static void Main(string[] args)
  9. {
  10. using(DirectoryEntry entry = new DirectoryEntry("IIS://localhost/W3SVC"))
  11. {
  12. object absobject = entry.NativeObject;
  13. Console.WriteLine("Name: {0}", entry.Name);
  14. }
  15.  
  16. Console.Write("Press any key to continue . . . ");
  17. Console.ReadKey(true);
  18. }
  19. }
  20. }
Add Comment
Please, Sign In to add comment