The previous post was based on a quick question from a premier customer. He is a never-ending source of intriguing questions and I always enjoy his "just one thing"-type of inquiries. They often force you to think a little extra. Anyway, the other day he came with a question, which (as always) seemed simple enough at a first glance. The goal was to set Feature Delegation for SMTP E-mail And Forms Authentication to "Read Only".
Now, most basic configuration topics have been covered in countless posts, and at first I thought that this shouldn’t be so hard. There is, however, a major difference. The SMTP E-mail and Forms Authentication settings are set in the root web.config. Not in applicationhost.config.
If we open up and compare web.config before, and after we change the setting, we’ll notice that the change made by the IIS Manager is adding the following into the root <configuration>-block:
Okay, so using what we already know from the old post we should put together a call that looks something like this:
Please note that this is NOT the correct syntax. It is close, but no cigar. What we need to do is:
- Correctly set the overrideMode. The above sample is not the way to do it.
- Make sure the changes are saved to web.config
So, the final, (and correct,) call to the Set-WebConfiguration cmdlet would look like this:
The Forms Authentication call would look like this:
I’ve searched quite extensively for samples on this and so far I’ve found none. So I thought someone should write it down. 🙂
Happy Holidays! / Johan