How can I set 404 and other error pages using web.config? I have tried adding following block in web.config.
It looks like you're using a relative path there. Could that be the problem?
Try using Fiddler to see what page your browser is being redirected to.