Just put
Response.End();
in the finally block , not in the try block.
It worked for me !!!.
I had the following problematic code structure (with exception)
... Response.Clear(); ... ... try{ if (something){ Reponse.Write(...); Response.End(); return; } some_more_code... Reponse.Write(...); Response.End(); } catch(Exception){ } finally{}
and this throws an exception. I suspect that an Exception is thrown where there is code / work to execute after response.End () ;, In my case, the extra code was just the result.
When I just moved response.End (); to the finally block (and left the return in its place), which leads to skipping the rest of the code in the try block and jumping to the finally block (not just leaving the contained function)), the Exception stopped happening.
The following steps work fine:
... Response.Clear(); ... ... try{ if (something){ Reponse.Write(...); return; } some_more_code... Reponse.Write(...); } catch(Exception){ } finally{ Response.End(); }
user2265251 Feb 19 '17 at 17:30 2017-02-19 17:30
source share