Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Exception on Response.Redirect

Exception on Response.Redirect

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hatim_ali
    wrote on last edited by
    #1

    Hi, Doing Repsonse.redirect causes an Exception with following message "Thread was being aborted". Do some one has any explanation for this ?? I need to catch any runtime error that occured and then redirect to a generic error page and in case of no error redirect user to another page. Now every time i do Response.Redirect, even on clean(no errors) execution, i got this exception. How to avoid this ?? Thanks in Advance, Regards.

    T 1 Reply Last reply
    0
    • H hatim_ali

      Hi, Doing Repsonse.redirect causes an Exception with following message "Thread was being aborted". Do some one has any explanation for this ?? I need to catch any runtime error that occured and then redirect to a generic error page and in case of no error redirect user to another page. Now every time i do Response.Redirect, even on clean(no errors) execution, i got this exception. How to avoid this ?? Thanks in Advance, Regards.

      T Offline
      T Offline
      Tomas Petricek
      wrote on last edited by
      #2

      Hi, this is not error, because if you call Response.Redirect with second parameter (end response immediately) set to true it will call Response.End() and there is no other way for Asp.Net to end response withou executing the rest of code than throwing exception. You can avoid this by calling redirect like this (but i think, that it is better to ignore this exception, than trying to avoid it):

      Response.Redirect("redirecturl.aspx",false);
      return;

      Tomáš Petříček (Microsoft C# MVP)
      www.eeeksoft.net | Photos | Fractal Snow

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups