Clear-Site-Data header error in Chrome console

Viewed 4396

I'm trying to implement a cache clearing button for our website that will append the Clear-Site-Data header on a specific route so we can be relatively sure that the users are getting the latest javascript, css, etc. after a release. I'm assigning the header in my ActionMethod like so: enter image description here

According to developer tools, I'm getting the header on the client:

enter image description here

So, Chrome is trying to do what I'm asking but it's throwing an error saying the types I'm passing it are unrecognized: console error when loading page with Clear-Site-Data header

Am I missing something with how I'm creating the header? Is this a bug?

1 Answers

Ok, so here we are a few months down the road and I finally remembered to come back and post the working solution. What I didn't understand at the time I asked the question was that the quotes are expected to be treated as literal in the response header examples I found. So the code I posted in my question was missing a few \ characters in the strings. What ended up working was this:

enter image description here

The headers on the client now look like this (note the quotes around cache and storage):

enter image description here

And the cache and localStorage are cleared as desired. Hope this helps someone else as well!

Related