preventing caching of 200 responses from calls to IIS ashx using web.config location path

25 Views Asked by At

BACKGROUND Our intranet webserver has an ashx running on it, which Windows desktop applications open via a WebClient object. The webClient object does this:

QueryString.Clear(); 
QueryString["ABC"] = [a string value that can vary];
return DownloadString(BaseAddress);

Recently the self-signed SSL certificate was changed, and there are a few PCs, not all, which are having trouble (cannot establish trusted connection error) when the WebClient object tries to call the ashx in the manner above, yet they have no problem opening web pages on that webserver with the browser, and so we know the client-side certificate is installed on these PCs properly.

QUESTION If we wanted to prevent caching of successful responses from that ashx using location path in the web.config file, can the name of the ashx page suffice (let's call it schedule.ashx) or do we need to account for every possible permutation of the QueryString parameters?

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

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

</configuration>

Also, does httpProtocol need to be changed to httpsProtocol?

0

There are 0 best solutions below