- bits & pieces about software development HostingAbc Logo
Show all posts.
If you've ever wondered how could you list all your usernames and passwords that are set on the 'Directory Security' tab on each website's properties (in inetmgr) then this small C# code snippet would be for you ..
Just a note: so far it seems that this code snippet works only on Windows Server 2003 - i have no ideea why doesn't it work on XP / Vista as well (don't care actually :) - i needed it for win 2003)...

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
static void Main(string{} args)
{
    DirectoryEntry iisBase = new DirectoryEntry("IIS://localhost/W3SVC");
    PrintUserNameAndPass(iisBase);
}

private static void PrintUserNameAndPass(DirectoryEntry iisChild)
{
    String userName = null; 
    String password = null;
    
    if (iisChild.Properties{"AnonymousUserName"} != null)
    {
        userName = iisChild.Properties{"AnonymousUserName"}.Value as String;
    }
    if (iisChild.Properties{"AnonymousUserPass"} != null)
    {
        password = iisChild.Properties{"AnonymousUserPass"}.Value as String;
    }

    if (userName != null && password != null)
    {
        if (!userNames.Contains(userName))
        {
            byte{} passwordChars = ASCIIEncoding.ASCII.GetBytes(password);
            Console.WriteLine(String.Format("{0}\t{1}", userName, 
              System.Convert.ToBase64String(passwordChars)));
            userNames.Add(userName);
        }
    }

    foreach (DirectoryEntry newChild in iisChild.Children)
    {
        PrintUserNameAndPass(newChild);
    }

    iisChild.Dispose();
}


Update: Actually I've found out that the exception on Windows Vista was caused by the lack of IIS6 compatibility module. So I've just had to install this compatibility module from Windows features and everything works as expected.
add linkThe last comments:custom usb flash drives says:wow, the radio very nice, Afonso says:I'm trying to make a raid1 on the asus 500gp and I've saw your thread. But I cannot find the md.o and the raid1.o on modules.tar.gz file you attached. I also have a linux noobie question here should I put the files to make the insmod command see themmike says:Good videosmoszidev says:Venemo: it is at System.Web.Configuration.HttpConfigurationSystem.UseHttpConfigurationSystem moszidev says:dumb, ... no wonder your name is dumb :) ... i more or less expected these type of answers :) - trust me, i know the double locking design pattern :) ... but it seems that you don't really know for what the locking is needed ;) ...dumb says:this is called double locking: http://en.wikipedia.org/wiki/Double_checked_locking_patternVenemo says:Where did you find this in the framework?
Copyright (C) 2007, Molnar Szilveszter m@il me