Custom Error Page in-SharePoint-2010

 when I try to delete an item from a list   i got  the error message as shown in below. The is typical  way ASP.NET Web Application throws the exception  to the user. Now in SharePoint 2010 we can redirect this error message to custom error page and we can show some fancy and useful information to user so that she/he understand very clearly about the error .
image 
Now we are going to redirect the above error message to our custom error page.   In Custom List we are going to add an  event & handle the an Item Deleted event.
First Create a SharePoint 2010  Event Receiver project.
image
Now we have asked to select project deployment options either Sandbox or Farm.  I am going to  deploy this project as Farm Solution .
image
Now Choose the Type of Event Receiver and Item source. In our  case Source is Custom List and Type of Event Receiver is List Items.
image
Once you selected above settings click finish.  VS.NET 2010 will create Event Handlers for the events you selected in the above list.
image
Now add  Application page  item to the project.
image
Design your custom Error page using HTML  as shown below.
image
Now add the event handler code for ItemDeleteing as Shown below.
 
   }
 }
}


Now Build ,deploy & test  the solution (Hit F5). Now go to any Custom list and try to delete an item.


image


now you will get this Custom Error message.


image

Comments