7

I have a subdirectory with a simple web.config

<configuration>
  <system.web>
    <!--<authorization>
      <allow roles="admin"/>
      <deny users="*"/>
    </authorization>-->
  </system.web>
</configuration>

I like to have security turned off in development. I like to do a quick deploy - Alt-B-H

Problem: Can I use my main web.release.config to take off the comments?

2 Answers 2

6

You can't remove comments with a config transform. However, you can remove the entire authorization element and all of its child elements.

Try placing the following in your Web.Debug.config:

<configuration>
  <system.web>
    <authorization xdt:Transform="Remove"/>
  </system.web>
</configuration>
Sign up to request clarification or add additional context in comments.

1 Comment

Your answer helped me here: stackoverflow.com/a/27404403/114029 Thanks again John! :)
4

I think you're looking at it the wrong way around Dave. Config transforms only get applied in a publish process which means when you're running locally (I assume this is what you mean by "turned off in development"), your web.config needs to be in the correct state for your local environment. If you don't want the auth node locally but you do want it remotely, you'll need config transforms to add it in the web.release.config file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.