When a user has not been given permissions to a particular site they receive the ugly "Error: Access Denied" page.
Is it possible to capture this on one particular team site (via custom webpart) and redirect the user to a custom access denied page that displays a more friendlier message (ex: "Thanks for your interest in [my company's team site]. Access has been limited at this time to physicians, fellows, physician extenders, clinical pharmacists, and nurses who are involved in patient care. If you need access for direct patient care and you have received this message, please contact firstname.lastname@example.org".
I found examples using SPSecurity.CatchAccessDeniedException, but it looks like user is being redirected to AccessDenied.aspx before the code gets executed. I placed the code in Page_PreRender()