This is a migrated thread and some comments may be shown as answers.

Delete a response header not working OnBeforeResponse

2 Answers 542 Views
Extensions and Customization
This is a migrated thread and some comments may be shown as answers.
Blanco
Top achievements
Rank 1
Blanco asked on 02 Oct 2015, 09:13 PM

Hi,

 I'm trying to remove the "Accept-Ranges" header before sending the response back to the client and I've added

oSession.oResponse.headers.Remove("Accept-Ranges");

to the OnBeforeResponse but it's not working (i.e. I still see the header in the response to the client).  I'm accessing a direct link to download the file. Something like:

http://acme.com/file1.dat

Thanks,

Blanco

 ‚Äč

2 Answers, 1 is accepted

Sort by
0
Eric Lawrence
Telerik team
answered on 05 Oct 2015, 07:04 PM
Hi, Blanco--

The typical explanation here is that you have the Stream option set in Fiddler's toolbar (or have otherwise enabled response streaming). In such a situation, the event handler in question (non-intuitively, but for good reasons) runs after the response is returned to the client. You can either disable streaming, or put your code in the OnPeekAtResponseHeaders handler instead. That handler always runs before the client gets content.

Regards,
Eric Lawrence
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Blanco
Top achievements
Rank 1
answered on 08 Oct 2015, 06:42 AM

Hi Eric,

I added the code into the OnPeekAtResponseHeaders and it worked like a charm.  Many thanks for your help!

 

Blanco

 

Tags
Extensions and Customization
Asked by
Blanco
Top achievements
Rank 1
Answers by
Eric Lawrence
Telerik team
Blanco
Top achievements
Rank 1
Share this question
or