0

I want to understand how can we handle rest service specific exceptions in MVC3. Any pointers? Basically, I have a Controller and there might be multiple try catch blocks and throw statements for exceptions. I'm a little confused after reading all posts. Edit:

public ActionResult Index()
    {
        IConsumerRequest conReq = oSession.Request();
        conReq = conReq.Get();
        conReq = conReq.ForUrl(Session["ServiceEndPoint"].ToString());
        try
        {
            conReq = conReq.SignWithToken();
        }
        catch (Exception ex)
        {
            throw ex;
        }

       return View();
    }

On throw exception, I need to be able to redirect to custom error page. I read through this post too: Custom error pages on asp.net MVC3 but how do i handle for different error codes like 302 or anything else if my application is not running on IIS.

Community
  • 1
  • 1
nimisha shrivastava
  • 2,357
  • 2
  • 16
  • 31

1 Answers1

2

Bellow is nice link for custom exp handling

Click Here

Sagar Modi
  • 770
  • 2
  • 7
  • 29
  • Thanks, the sample you have shared is really good. I will try it my next project for sure. For now I implemented using this approach- http://forums.asp.net/t/1505777.aspx – nimisha shrivastava Jul 22 '13 at 12:58