Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding context.Response.Headers.Add("Cache-Control", "no-cache"); says IIS integrated pipeline required?

Not sure if this makes sense, but why did adding the code on my http handler (responds to a ajax request returning a json result):

adding context.Response.Headers.Add("Cache-Control", "no-cache");

cause an error and say integrated pipeline mode has to be set?

like image 749
mrblah Avatar asked Aug 18 '09 14:08

mrblah


1 Answers

@homestead, you are doing wrong, you cannot set headers this way, microsoft says:

"The Headers property is only supported with the IIS 7.0 integrated pipeline mode and at least the .NET Framework 3.0. When you try to access the Headers property and either of these two conditions is not met, a PlatformNotSupportedException is thrown."

So, if you want to set headers you have to use context.Response.AddHeader("headerName", "someValue"); instead and your code should add the header successfully.

like image 57
Cleiton Avatar answered Oct 25 '22 19:10

Cleiton