Unless you love the default SharePoint 2010 error pages for 404 (not found) and 401 (access denied), it is usually a good idea to change them. The steps are a bit different than a standard ASP.net application.
1) Browse to C:\inetpub\custerr\
2) You should now see a list of localization folders like en-US or fr-FR. Open the folder you want to edit and modify the error pages for 401,403,404 and 500.
3) Now browse to C:\inetpub\wwwroot\wss\VirtualDirectories\ and open the folder associated to the Sharepoint site you would like to affect.
4) Edit the file web.config and find the keyword customErrors. Replace the complete customErrors code block with:
5) Now find the keyword <system.webServer>. Inside this block, place the following block code. (If the httpErrors block already exists, replace it completely!)
6) Save web.config and do the usual iisreset command if needed.