How to remove s-maxage header from asp.net mvc response

By default, Asp.Net MVC (at least my setup) seems to send a header with a value

Cache-Control: private, s-maxage=0 

I need to remove the s-maxage = 0 part. The reason is that IE6 does not seem to handle the content-disposition: attachment header correctly if that header is present.

The end of the effect that I am observing is that if the user decides to open the downloaded file instead of saving it, it is not actually saved. The difference between a working version of non-mvc and a non-working version of mvc is just that header.

Working response:

 HTTP/1.1 200 OK Server: ASP.NET Development Server/9.0.0.0 Date: Thu, 10 Feb 2011 19:35:47 GMT X-AspNet-Version: 2.0.50727 Content-Disposition: attachment; filename=results.txt Cache-Control: private Content-Type: text/plain; charset=iso-8859-1 Content-Length: 210 Connection: Close <<DATA>> 

Non-working answer:

 HTTP/1.1 200 OK Server: ASP.NET Development Server/9.0.0.0 Date: Thu, 10 Feb 2011 20:24:04 GMT X-AspNet-Version: 2.0.50727 X-AspNetMvc-Version: 1.0 Content-Disposition: attachment; filename=results.txt Cache-Control: private, s-maxage=0 Content-Type: text/plain Content-Length: 90 Connection: Close <<DATA>> 
+4
source share
1 answer

What version of MVC are you using? I use MVC 4, and by default (for example, for the main page when using the Internet template), the header as you wish:

 Cache-Control: private 
0
source

Source: https://habr.com/ru/post/1339267/


All Articles