1. Add following section in web.config
<customErrors mode="On">
<error statusCode="404" redirect="~/error404.aspx" />
</customErrors>

2. Get wrong page from query string
string from = Request.QueryString["aspxerrorpath"];

Advertisements