Lim
Lim

Reputation: 131

Response.ClearHeaders() replacement for .NET Core

I have used Response.ClearHeaders(); in a Controller action method. But it returns an error like:

'HttpResponse' does not contain a definition for 'ClearHeaders' and no accessible extension method 'ClearHeaders' accepting a first argument of type 'HttpResponse' could be found (are you missing a using directive or an assembly reference?)

Can you please help on this?

Upvotes: 0

Views: 922

Answers (1)

Richard Deeming
Richard Deeming

Reputation: 31228

Use the Response.Clear() extension method instead.

This invocation resets the response headers, response status code, and response body.

Upvotes: 1

Related Questions