404 redirect in .net website

Use following code for 404 redirect in .net website

Add below code in your web.config file

<customErrors mode="RemoteOnly" defaultRedirect="your_redirect_url" redirectMode="ResponseRewrite">
   <error statusCode="404" redirect="your_redirect_url" />
</customErrors>

<httpErrors errorMode="Custom" existingResponse="Replace">
	<remove statusCode="401" subStatusCode="-1" />
	<remove statusCode="403" subStatusCode="-1" />      
	<remove statusCode="404" subStatusCode="-1" />                
	<remove statusCode="500" subStatusCode="-1" />
	<error statusCode="401" path="your_redirect_url" responseMode="Redirect" />
	<error statusCode="403" path="your_redirect_url" responseMode="Redirect" />
	<error statusCode="404" path="your_redirect_url" responseMode="Redirect" />                
	<error statusCode="500" path="your_redirect_url" responseMode="Redirect" />
</httpErrors>