Delete a response header not working OnBeforeResponse

3 posts, 0 answers
  1. Blanco
    Blanco avatar
    2 posts
    Member since:
    Oct 2015

    Posted 02 Oct 2015 Link to this post

    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. Eric Lawrence
    Admin
    Eric Lawrence avatar
    833 posts

    Posted 05 Oct 2015 Link to this post

    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
  3. Blanco
    Blanco avatar
    2 posts
    Member since:
    Oct 2015

    Posted 08 Oct 2015 in reply to Eric Lawrence Link to this post

    Hi Eric,

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

     

    Blanco

     

Back to Top