Displaying a Custom Error Page
<customErrorsmode="RemoteOnly"defaultRedirect="/ErrorPages/Oops.aspx">
<errorstatusCode="404"redirect="/ErrorPages/404.aspx"/>
</customErrors>
http://www.asp.net/web-forms/tutorials/deployment/displaying-a-custom-error-page-cs