0

Our default website in IIS has a folder in it that houses a web-application. There are several applications and we want to limit the effect to only the one:

     >   c:\inetpub\wwwroot\foo

There are folders beneath \foo, each of which has an HTML page of the same name:

       > foo
           sis
              publish.htm
           boom
              publish.htm
           bah
              publish.htm

These publish.htm files will be edited from time to time. We want to prevent them from being cached in Microsoft Edge. They are ClickOnce files and only Edge v92 or later will be used to open them.

Could this web.config be placed in each of the child folders, sis, boom, and bah? Is there a way of putting it in folder foo and editing the path so it includes any path that leads to any file called publish.htm?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

  <location path="publish.htm">
    <system.webServer>
      <httpProtocol>
        <customHeaders>
          <add name="Cache-Control" value="no-cache" />
        </customHeaders>
      </httpProtocol>
    </system.webServer>
  </location>

</configuration>
Tim
  • 8,669
  • 31
  • 105
  • 183
  • Did you try placing web.config in foo directory and giving relative path to publish.html files? You will require seperate entry for each relative publish.html file path. – Pankaj Kapare Oct 05 '21 at 18:25
  • @PankajKapare: Would there be multiple paths, separated by commas? There is a publish.htm in each of those three sub-folders. – Tim Oct 05 '21 at 18:28
  • 1
    Multiple location tags. One for each path. – Pankaj Kapare Oct 05 '21 at 18:34
  • Ah, didn't know that could be done! – Tim Oct 05 '21 at 18:46
  • @Tim Has your problem been solved? – samwu Oct 06 '21 at 01:55
  • @samwu: testing now. – Tim Oct 06 '21 at 10:34
  • Running into a problem where the page does not load if I have multiple location elements in the parent folder's web.config, using the subfolder-name as the path, and the subfolders have a web.config also, with a single location element using the file-name as the path. Decided to eliminate the web.config from the parent folder. – Tim Oct 06 '21 at 20:53

0 Answers0