Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I also get this same error message. Here are some more details on it:

 

Error Number: 5

Error Description: Thread was being aborted.

Exception Message: Thread was being aborted.

Exception Type: System.Threading.ThreadAbortException

Base Exception: Thread was being aborted.

Base Exception Type: System.SystemException

  • 3 weeks later...
Posted

I'm having this problem too.

 

What does this mean exactly? I thought that server.transfer stopped execution of the current code and transfered to the new page... Should I add an exit sub or something???

 

Or maybe I should throw an error and let a main error handler deal with the error??

 

I can't seem to find any decent examples of how to handle error handling in ASP.NET, and my books from Amazon won't arrive for another couple of days...

Posted

It seems to everyone get the same error, when I use Response.Redirect or Server.Transfer, then this error will occurs.

 

I found this problem since the first day I use ASP.NET (more than 1 year)... but still not idea about it...

  • 3 weeks later...
Posted

Thread is being aborted

 

you can still use the

Try block but this is the way you need to do it.

 

Try

 

Catch e as exception

 

Finally

 

Response.Redirect("") 'this will work here

 

End Try

  • 1 month later...
Posted

Hello,

 

I have found a work arround for this problem below is the way i have implemented

 

Try

<Your Code>

 

TransferPage()

Catch ex as Exception

If ex.GetType.ToString.ToLower = "system.threading.threadabortexception" Then

TransferPage()

Else

DisplayError(ex)

End If

 

Finaly

 

End try

 

Protected Sub TransferPage()

Response.Redirect("<your required location>")

End Sub

 

 

Hope this will help...

Posted

(or preferably)

 

Catch ex as System.Threading.Threadabortexception

... do nothing

 

as Robby says, this always happens, and I've seen it in every ASP.NET app I've worked on, so deal with it

  • 3 weeks later...
Posted

I would imagine this problem occurs because the try catch block is the unfinished thread another way round it to be sure the thread has completed would be.

 

c#

 

// Used as workaround because

// Response.Redirect Creates error inside try catch block

 

bool responseRedirect = false;

 

try {

 

// Do STUFF here

 

responseRedirect = true;

 

}

catch {

 

// Do error Stuff

 

}

 

// Will only occur if responseRedirect = true

if (responseRedirect) {

 

Response.Redirect("CandidateList.aspx");

 

}

Posted

Info from MS

 

from the Microsoft site:

 

ThreadAbortException is a special exception that can be caught by application code, but is re-thrown at the end of the catch block unless ResetAbort is called. ResetAbort cancels the request to abort, and prevents the ThreadAbortException from terminating the thread. Unexecuted finally blocks are executed before the thread is aborted.

 

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemthreadingthreadclassaborttopic2.asp

Posted

details about redirect:

 

[C#]

public void Redirect(

string url,

bool endResponse

);

 

URL

The target location.

endResponse

Indicates whether execution of the current page should terminate.

 

 

so, i.e. set endResponse to false and execution of the following code in your method will be executed.

 

example Response.Redirect("bla.aspx", false);

  • 2 weeks later...
Posted

Hi Guys!

 

Please use -> Response.Redirect("yourpage", false)

instead of -> Response.Redirect("yourpage")

 

This is is the only bull happening here

 

bye and regards.

 

SHIMAIL AHMED GILLANI

KARACHI, PAKISTAN

  • 1 year later...
Posted
Hi Guys!

 

Please use -> Response.Redirect("yourpage", false)

instead of -> Response.Redirect("yourpage")

 

This is is the only bull happening here

 

bye and regards.

 

SHIMAIL AHMED GILLANI

KARACHI, PAKISTAN

 

Have followed the example, no exception being thrown, but I am getting the following error: "A page can have only one server-side Form tag."

 

Where to now?

 

Mike55.

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

Posted

Yea, thats the first thing that I checked, got around the problem by setting a variable to -1 if the exception occured, then in the Finally part I did an if statement that checked if the variable was -1 or another value. Based on the variables value I then redirected to the required page.

 

Mike55

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...