I have a controller action like this:
public ActionResult Index(string url)
{
var pageTitle = url.Split('/')[0];
var page = Services.PageService.GetPage(pageTitle);
if (page == null)
{
throw new HttpException((Int32) HttpStatusCode.NotFound, "NotFound");
}
return View(page);
}
Everytime I am debugging my site, when the HttpException is thrown I get a prompt from Visual Studio notifying me that the exception was unhandled by user code.
I guess I just want somebody to clarify that what I am doing is correct, and that this notification can be dismissed without worry. The event still bubbles up to the Application_Error method in my Global.asax file where I am actually handling HttpException's, so as far as I can tell the only problem is the inconvenience of VS telling me every time this exception is thrown.