Asp addheader method. Web Jul 15, 2025 · The ASP AddHeader Method is used to specify for adding a new named for the HTTP Header and provide and given a value to the HTTP Response. In this back to basics post I describe what HTTP header, why you might set them and show how to set them as part of individual requests as well as globally The AddHeader method adds a new HTTP header and a value to the HTTP response. NET objects or methods like Response. AppendHeader("Content-encoding", "gzip"); 'HttpResponse' does not contain a definition for 'AppendHeader' and no accessible extension method 'AppendHeader' accepting a first argument of type 'HttpResponse' could be found (are you missing a using directive or an assembly . Jul 29, 2014 · Index { HttpContext. Namespace: System. AddHeader("Pragma", "no-cache"); return View(); } If you want this header to be added on more than one request, you could wrap the code in a custom action filter as per this answer. Most of the time, you'll end up setting headers indirectly, using other ASP. AddHeader () is an older method, geared towards IIS6. Response. kapvbe nkva sgd twwlk qfymt zjoikr hoeau xhrtknz ojy qlsggma