'How do I' get redirected to the default Error or Success layouts pages?
You just want the error message to be displayed on the default SharePoint error page. Is this an easy
In Microsoft.SharePoint.Utilities.SPUtility there are 2 functions:
- SPUtility.TransferToErrorPage - this transfers the user to the administrative layouts page for error messages
- SPUtility.TransferToSuccessPage - this transfers the user to the page one would see after something such as a long running transaction
There are a few overloads for each and they come in handy when developing custom admin pages or custom lists.
Comments
Anonymous
January 25, 2009
PingBack from http://www.clickandsolve.com/?p=1038Anonymous
March 10, 2009
Okay that's easy. I also read your other post, "'How do I' create a long running operation page (gears page)?". Now the "tricky" question: How do I combine both SPLongOperation and SPUtility.TransferToSuccess / SPUtility.TransferToError Basically I have a few cases where a long operation will either succeed or fail. In order to have the best SharePoint integration possible, I would like to make use of the default Success and Error pages. Until now, I have just been able to redirect to those pages, without having the possibility of passing a custom success/error message however.Anonymous
January 22, 2010
hi, i am having mulitple vs statemachine workflows and mulitple site collections, web parts, in my KM portal. can you tell em how can i tell me how can i customize the error page for each and every workflow , each and every web part? it would be great if you provide me in your blog. thnx agniAnonymous
January 26, 2010
@Dinesh (never saw this) You can try putting the operation in a try/catch block. When it fails, if the TransferToError doesn't work, you may need to put the the operation.End in the beginning of the catch block and then your TransferToError call. You may also try adding a Response.Clear somewhere in there. No redirection will happen until the response header is sent. @agnihotri What's a KM portal? You will need to use a different mechanism to handle error messaging, specifically, you'll want to redirect your users to a page that displays specifically for your error messages--you can pass in values via query string. The TransferToError function simply sends the user to the default SharePoint error page that has the stack trace with the master page layout.