Hello,
This is stored in the DefaultDoc property. An example using VBScript:
set vdirObj=GetObject("IIS://localhost/W3SVC/1")
WScript.Echo("DefaultDoc property value: " & vdirObj.DefaultDoc)
Also see:
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/5e129
239-a4bd-4c6b-a6f0-63a69a47e895.mspx

Signature
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info
>we can config IIS's default webpages such as: index.htm, index.asp,
>default.asp, etc.
>
>but how to get those names in a programming language?
>
>best regards.
iclinux - 28 Dec 2005 05:25 GMT
thanks a lot, Kristofer Gafvert.
I implemented it in C++ as follow:
///////////////////////// CODE START //////////////////////////
BOOL GetDefaultDoc()
{
IADsContainer* iContainer = NULL;
IADs* iAds = NULL;
HRESULT hr = ADsGetObject(L"IIS://localhost/w3svc",
IID_IADsContainer, (void**)&iContainer);
if (SUCCEEDED(hr)) {
hr = iContainer->GetObject(_bstr_t("IIsWebServer"),
_bstr_t("1"), (IDispatch**)&iAds);
if (SUCCEEDED(hr)) {
VARIANT buf = { 0 };
if (S_OK == iAds->Get(_bstr_t("DefaultDoc"), &buf)) {
LogMessageW(V_BSTR(&buf)); // Log the default name
return TRUE;
}
}
}
return FALSE;
}
///////////////////////// CODE END //////////////////////////
But I have another question:
we can config the default webpage's name at least 3 places in IIS: the
first is the topmost, it contains all the websites; the second is
website in it; and the third is the virtual directory of a website.
how to get the default webpage's name in those three places?
in another words, how to get those names given a url such as
"http://localhost/DirectoryName/"?
Best Regards
Kristofer Gafvert - 28 Dec 2005 08:20 GMT
It is again stored in the DefaultDoc property, but you change:
IIS://localhost/w3svc
to
IIS://localhost/w3svc/1
or
IIS://localhost/w3svc/1/VirtualDirectoryName
where 1 is a valid website ID.

Signature
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info
>thanks a lot, Kristofer Gafvert.
>
[quoted text clipped - 35 lines]
>
>Best Regards
iclinux - 29 Dec 2005 07:04 GMT
Kristofer Gafvert, thanks again.
I've tried, but the follow two vbscripts displayed the same on my
pc(WinXP SP2, IIS5.1)
set vdirObj=GetObject("IIS://localhost/W3SVC/1")
WScript.Echo("DefaultDoc property value: " & vdirObj.DefaultDoc)
set vdirObj=GetObject("IIS://localhost/W3SVC")
WScript.Echo("DefaultDoc property value: " & vdirObj.DefaultDoc)
those two vbscript only got the default webpage name of "the topmost"
I mentioned above.
any help, or any documents about this?
regards
iclinux - 29 Dec 2005 07:08 GMT
forgot to say, the default webpage names of "the topmost" and "the
second" are different.
Kristofer Gafvert - 29 Dec 2005 07:44 GMT
I think i know what is going on.
You have changed the Default Document using IIS Manager, right? This
changes the DefaultDoc property of:
IIS://localhost/W3SVC/1/ROOT
So the DefaultDoc property of
IIS://localhost/W3SVC/1
has not been changed, and is the same as for
IIS://localhost/W3SVC
So try with the ROOT.
I would also recommend you to donwload IIS 6.0 Resource Kit Tools, and
install Metabase Explorer (works on Windows XP and Windows Server 2003)
This will help you understand the metabase, and you can verify if what is
returned by your code, matches with what is written in the metabase.

Signature
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info
>Kristofer Gafvert, thanks again.
>
[quoted text clipped - 13 lines]
>
>regards
iclinux - 30 Dec 2005 07:20 GMT
thanks a lot, Kristofer Gafvert: )
With your great help, I can get those names.
After installing IIS 6.0 Resource Kit Tools on my pc, I get a lot that
I didn't know from Metabase Explorer.
Now, I implemented a ISAPI Filter, and add it to a website. I tryied to
get the ID of that website, but failed...
Can a ISAPI Filter get the ID of the website which it's added in?
Greatly appreciate your kindness.
iclinux - 30 Dec 2005 07:25 GMT
Oh, I suddenly notice that there a 'Filter' in Metabase Explorer, it
should be what I want.
Sorry to trouble you :)