SPUtility.TransferToErrorPage Method
SPUtility.TransferToErrorPage
Description
The SPUtility.TransferToErrorPage method redirects the user to the built-in error page provided by Windows SharePoint Services. The method accepts a parameter for the error message to be displayed and, optionally, parameters that represent a link to be displayed with the error message.
Usage Scenario
You can use the SPUtility.TransferToErrorPage method in any Web Part or custom code as a means of providing robust error handling while ensuring the user experience is consistent with the general SharePoint errors. The following code samples show how to use the SPUtility.TransferToErrorPage method in an exception-handling structure.
C# Code Sample
try
{
//Code that might cause an exception
}
catch (Exception ex)
{
SPUtility.TransferToErrorPage(ex.Message);
}
Visual Basic.NET Code Sample
Try
'Code that might cause an exception
Catch ex As Exception
SPUtility.TransferToErrorPage(ex.Message)
End Try
- 3/12/2008
- Content Master Ltd