Scenario:
You want to display proper Error page or Access Denied page when any error occurs in your custom code.
Access Denied error:
Transferring to Error page:
try{
//Code goes here
}
catch(Exception ex){
SPUtility.HandleAccessDenied(ex);
}
SPUtility.TransferToErrorPage("Message goes here");
Remarks:
Use TransferToErrorPage to transfer control to error page, if some code is already executing , then this may throw another error.. 'System.Thread Abort'.
Article:
0 comments:
Post a Comment