We help IT Professionals succeed at work.

IIS7 APPCMD - How to set 404 document for all sites

trg_dk
trg_dk asked
on
I finally got my APPCMD scripts to work, and now the client wants me to set the 404 document for all the sites, to default.asp for each site.

How can I do this ?
Comment
Watch Question

Author

Commented:
Doesn't any of you guys have time to help me out with this one ?

Commented:
This article gives how do do a custom error page via the appcmd scripting tool

http://technet.microsoft.com/en-us/library/cc753103%28WS.10%29.aspx

Author

Commented:
@Rovastar, thanks for the link.

I got this from the article, just a little bit uncertain how to use it correct...

appcmd set config /section:httpErrors  /+"[statusCode='401',subStatusCode='2',prefixLanguageFilePath='%SystemDrive%\inetpub\custerr',path='401.htm',ResponseMode='File']"

Can I use it to set ALL my sites, in one go, to use default document at the respective site root ? ("/" I guess?)

Best regards,
Mark
Commented:
YOu can set this at the server level. The syntax of appcmd is a little picky so try it out on a test box first (as for any (major) change to a production enviornemnt) to get more confidence in doing IIS scripting.