SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to display a notification after an item was added through a custom visual web part.

If I try to use the TransferToSuccessPage(String), Sharepoint goes in error Thread Abort.


share|improve this question
I'm using Sharepoint 2010 – Albevi Aug 12 '11 at 15:19

Any transfer or redirect function called in the postback of a web page has the potential of throwing this error because the underlying implementation of these type of functions calls Response.End(), which causes page execution to abort.

I think it's probably safe to eat the error...i.e. put a try/catch around the TransferToSuccessPage call.

Alternatively, you could emit some javascript from the postback to display an alert or put something in the notification area, assuming we're talking about SP2010.

UPDATE: Try this...

SPUtility.Redirect("success.aspx", SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current, HttpUtility.UrlEncode("SuccessText=It worked!"));

Change the SuccessText to whatever you want. If that doesn't work put a try/catch around the SPUtility.Redirect's not the underlying transfer or redirect that's throwing an error, it's the Response.End that fires after it, so the redirect should still take place if you trap the error.

share|improve this answer
So I have not a server side solution? – Albevi Aug 12 '11 at 15:20
Read update to answer... – Rob D'Oria Aug 12 '11 at 16:07
this solution is really ugly – Albevi Aug 12 '11 at 16:48
what do you mean? – Rob D'Oria Aug 12 '11 at 16:51

I can't test this at the moment, but wouldn't this work?

Response.Redirect(targetUrl, false)

Per Reflector, that does not execute a .End() and would allow the thread to finish its normal life cycle.

share|improve this answer
As said previously you can do this after an item.Update(); – Albevi Aug 14 '11 at 6:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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