views:

11

answers:

0

I am using ELMAH to catch and log all errors from controllers. But when errors happening i may display generic information to user using then Shared/Error.aspx will display if any error.

But i have some exceptional case in my app and i need to display some custom error page with some information to user, for example i have such case: user submit information to database, then if he go back in browser history and click submit again i need to display error that hi is already submit his form.

For that case i did create my custom error controller and error view. Than on submit controller i am checking if he already submitted the form i am redirecting him to my custom error controller and displaying custom error view. On error controller action i am doing like that:

        Response.StatusCode = (int)HttpStatusCode.Gone;
        return View();

Am i doing all right or there can be some more correct ways of doing this? Any suggestions?