Hello

When I go to my website in IIS and click properties and then go the custom errors tab, there is only one listed.? 500;100 URL /iisHelp/common/500-100.asp.. Can anyone please explain to me how I add all of the custom erros back

Thank you

RE: IIS 5.0 Custom Errors Tab by yonlinemanghn

yonlinemanghn
Wed Jun 09 18:13:46 CDT 2004

Hello,
What happens if you create a new site? Do you see all the custom errors for
this new site?
Here's a not-very-elegant script that you can use to add back the default
custom errors:

**************start of script*************
Dim NewArr
Dim IISSrverObj
Dim siteID

siteID = 1
Set IISSrverObj = GetObject("IIS://localhost/W3SVC/" & siteID & "/Root")

NewArr = IISSrverObj.GetEx( "HttpErrors" )
ReDim NewArr(31)

NewArr(0) = "400,*,FILE,C:\WINNT\help\iisHelp\common\400.htm"
NewArr(1) = "401,1,FILE,C:\WINNT\help\iisHelp\common\401-1.htm"
NewArr(2) = "401,2,FILE,C:\WINNT\help\iisHelp\common\401-2.htm"
NewArr(3) = "401,3,FILE,C:\WINNT\help\iisHelp\common\401-3.htm"
NewArr(4) = "401,4,FILE,C:\WINNT\help\iisHelp\common\401-4.htm"
NewArr(5) = "401,5,FILE,C:\WINNT\help\iisHelp\common\401-5.htm"
NewArr(6) = "403,1,FILE,C:\WINNT\help\iisHelp\common\403-1.htm"
NewArr(7) = "403,2,FILE,C:\WINNT\help\iisHelp\common\403-2.htm"
NewArr(8) = "403,3,FILE,C:\WINNT\help\iisHelp\common\403-3.htm"
NewArr(9) = "403,4,FILE,C:\WINNT\help\iisHelp\common\403-4.htm"
NewArr(10) = "403,5,FILE,C:\WINNT\help\iisHelp\common\403-5.htm"
NewArr(11) = "403,6,FILE,C:\WINNT\help\iisHelp\common\403-6.htm"
NewArr(12) = "403,7,FILE,C:\WINNT\help\iisHelp\common\403-7.htm"
NewArr(13) = "403,8,FILE,C:\WINNT\help\iisHelp\common\403-8.htm"
NewArr(14) = "403,9,FILE,C:\WINNT\help\iisHelp\common\403-9.htm"
NewArr(15) = "403,10,FILE,C:\WINNT\help\iisHelp\common\403-10.htm"
NewArr(16) = "403,11,FILE,C:\WINNT\help\iisHelp\common\403-11.htm"
NewArr(17) = "403,12,FILE,C:\WINNT\help\iisHelp\common\403-12.htm"
NewArr(18) = "403,13,FILE,C:\WINNT\help\iisHelp\common\403-13.htm"
NewArr(19) = "403,15,FILE,C:\WINNT\help\iisHelp\common\403-15.htm"
NewArr(20) = "403,16,FILE,C:\WINNT\help\iisHelp\common\403-16.htm"
NewArr(21) = "403,17,FILE,C:\WINNT\help\iisHelp\common\403-17.htm"
NewArr(22) = "404,*,FILE,C:\WINNT\help\iisHelp\common\404b.htm"
NewArr(23) = "405,*,FILE,C:\WINNT\help\iisHelp\common\405.htm"
NewArr(24) = "406,*,FILE,C:\WINDOWS\help\iisHelp\common\406.htm"
NewArr(25) = "407,*,FILE,C:\WINDOWS\help\iisHelp\common\407.htm"
NewArr(26) = "412,*,FILE,C:\WINDOWS\help\iisHelp\common\412.htm"
NewArr(27) = "414,*,FILE,C:\WINDOWS\help\iisHelp\common\414.htm"
NewArr(28) = "500,12,FILE,C:\WINDOWS\help\iisHelp\common\500-12.htm"
NewArr(29) = "500,13,FILE,C:\WINDOWS\help\iisHelp\common\500-13.htm"
NewArr(30) = "500,15,FILE,C:\WINDOWS\help\iisHelp\common\500-15.htm"


IISSrverObj.PutEx 2, "HttpErrors", NewArr
IISSrverObj.SetInfo

MsgBox "Entry was Successful"

Set IISSrverObj = Nothing

**************end of script**************

1) Backup the IIS Metabase before running this script so that if something
goes wrong you can restore from this backup.
2) Save the above code in a notepad file and save it as customerror.vbs
3) Edit the code above to change the "siteID = 1" to the appropriate site
id. To confirm your site id, right click on the site in the IIS MMC, go to
Properties-> under the Website tab, click on the Properties button in the
enable logging section-> under the General properties tab, you will see the
Log file name in the format w3svc<siteid>/exyymmdd.log.
If you want to do this for all the sites, then here is what the code will
look like
Dim NewArr
Dim IISSrverObj

Set IISSrverObj = GetObject("IIS://localhost/W3SVC/" & "/Root")

NewArr = IISSrverObj.GetEx( "HttpErrors" )
ReDim NewArr(31)
..
...

Save and close the log file.
4) From command window switch to the folder where you saved this script and
run "customerror.vbs"
5) Restart IIS by running the command "iisreset"
6) Open the IIS Manager and confirm if you see the custom errors.

Hope this helps!!!
Thanks,
Yogita Manghnani
Microsoft Developer Support
Internet Information Server

*********************************************************************
>>Please do not send email directly to this alias. This is an online
account name for newsgroup participation only.<<

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.

© 2003 Microsoft Corporation. All rights reserved.
*********************************************************************