Unless you love the default Sharepoint 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:

<customErrors defaultRedirect="404.htm" mode="On">
	   <error redirect="401.htm" statusCode="401" />
	   <error redirect="403.htm" statusCode="403" />
	   <error redirect="404.htm" statusCode="404" />
	   <error redirect="500.htm" statusCode="500" />
</customErrors>

5) Now find the keyword <system.webServer>. Inside this block, place the following block code. (If the httpErrors block already exists, replace it completely!)

<httpErrors errorMode="Custom" existingResponse="Auto">
</httpErrors>

6) Save web.config and do the usual iisreset command if needed.