I'm building a web application which IIS will use to serve many domains. For example I will set up [[login to view URL]][1] and the app will accept further domains from users and add these to the IIS configuration for the web appliaction. DNS changes will be handled outside the system so a user will get [[login to view URL]][2] pointed to my server's IP address and then use my web app to add in [[login to view URL]][2] so that my app responds to his received http requests.
I need a piece of code that will let me add specified domain headers to the IIS settings for the web application (and also remove them if possible). The code must run within an ASPX (preferably VB.Net) and the ASPNET account does not have administrator access so impersonation must be taken into acount.
I know there's probably some example code somewhere that does what I need, but if someone can find it for me and present it in a way I can use easily I'll pay a reasonable amount.
Icing on the cake would be definite feedback, so I could take some defined action upon success (e.g. raise an invoice) or alternate action on failure (e.g. email tech support to get it added manually).
## Deliverables
Fully commented code module and any dependencies.
Fully described configuration file (so I can set any required username/password or server/IIS details outside of compiled code)
Test rig aspx page to demonstrate usage and verify function.
## Platform
Windows 2000 server (+patches)
IIS 5.0 (+patches)
Microsoft .Net framework 1.1.4322