0

I have

args.AbortPipeline();
HttpContext.Current.Response.Redirect(result.Url + $"?q={searchTerm}", true);

but the request continues to the controller

  • Did you try Response.End()? – Gatogordo Apr 23 at 14:20
  • yes, it had the same issue – Matthew Butler Apr 23 at 14:30
  • You want Server.Transfer. Same way 404 pages are served up. stackoverflow.com/questions/15002551/… – jrap Apr 24 at 1:29
  • Let me know if that suggestion works. If so, I'll add a proper answer. – jrap Apr 24 at 15:10
  • I used a HttpRequestProcessor instead of the RequestBeginProcessor, then the redirect worked as expected – Matthew Butler Apr 25 at 10:37
0

Redirect( [URL], true ) is supposed to throw an "abort exception", so the only code in your thread which will execute after that call should be any catch/finally blocks. This is in fact how it works on my sites. Without further evidence, I have to question whether your thread is in fact "continuing to the controller", or whether you're being misled somehow by your debugging/diagnostic techniques.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.