You are already doing the correct thing. You can look at Fiddler to confirm this.
However, there is no guarantee that a browser will honor your content. Wikipedia notes:
Internet Explorer (before Internet Explorer 7), however, will not display custom pages unless they are larger than 512 bytes, opting to instead display a "friendly" error page. Google Chrome includes similar functionality, where the 404 is replaced with alternative suggestions generated by Google algorithms, if the page is under 512 bytes in size.
Some trial and error and massaging of your view may be necessary in order to come up with a page which various browsers will actually elect to display.