xmichaelm
asked on
HOWTO: Programatically Configure Error Pages Features Settings in IIS 7.0
I would like to programmatically (C#) configure IIS 7.0 for a given application, to do the equivalent of manually:
Computer Management => Services and Applications => Internet Information Services => Sites => Default Web Site => ApplicationName => Error Pages
Clicking "Edit Feature Setttings..."
Under "Error Reponses" set "When the server encounter an error, return:" to "Custom error pages".
Thanks,
Michael
Computer Management => Services and Applications => Internet Information Services => Sites => Default Web Site => ApplicationName => Error Pages
Clicking "Edit Feature Setttings..."
Under "Error Reponses" set "When the server encounter an error, return:" to "Custom error pages".
Thanks,
Michael
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
check http://learn.iis.net/page.aspx/155/an-overview-of-feature-delegation-in-iis-70/ for further reading about IIS configuration
ASKER
I tried to adapt the sample code you have posted to configure a single application (as I requested in my question above), but I get the following exception:
System.Reflection.TargetIn
rget of an invocation. ---> System.IO.FileLoadExceptio
ion cannot be used at this path. This happens when the section is locked at a pa
rent level. Locking is either by default (overrideModeDefault="Deny
plicitly by a location tag with overrideMode="Deny" or the legacy allowOverride=
"false".
See source code below.
Thanks,
Michael
Open in new window