User opens mysite.com/products.aspx?product_id=1234
In my Page_Load() I decide whether the product with such id exists or not.
If not I want user to see my custom error 404 (which is in my "/404.aspx" page).
In web.config I wrote:
<customErrors mode="On" Go to the complete details ...