web.config transformation

2.1k views Asked by At

I'm trying to make the web config transformation to work properly but with no success.

I have a folder in my web app containing the following:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <authorization>
      <allow roles="ADMINISTRATORS"/>
      <allow roles="OPERATOR"/>
      <deny users="?"/>
    </authorization>
  </system.web>
</configuration>

I created the transform files and I moved section in the Release transform version. Unfortunately this is not working. If the configuration is set to Debug I do not want to have that section in my web config, else I would need to have.

Any suggestions on how to make it work?

1

There are 1 answers

0
MaiOM On

Thanks for the links, I saw them already before, but never stop to read everything.

The solution is simple (to be set in:

<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations 
     see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

  <system.web>
    <authorization>
      <allow roles="ADMINISTRATORS" xdt:Transform="Insert"/>
      <allow roles="OPERATOR" xdt:Transform="Insert"/>
      <deny users="?" xdt:Transform="Insert"/>
    </authorization>
  </system.web>

</configuration>