In the event my project is deployed with an incorrect, incomplete or missing connection string i'd like an application startup check for db connectivity, and if there is none, direct all requests to a DatabaseConnectionError page of some sort, what are my options? I don't think there's a specific http error code that would fit this error, and I'm not currently using web.config to define a generic catch all for all errors.
I do have
/// <summary>
/// from http://www.davidjuth.com/asp-net-mvc-error-handler.aspx
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
protected void Application_Error(object sender, EventArgs args)
{
Exception ex = Server.GetLastError();
using (var crashFile = new System.IO.StreamWriter(Server.MapPath("~/App_Data/Crash_" + DateTime.UtcNow.ToString("yyyyMMdd") + ".log")))
crashFile.WriteLine("<crash><time>" + DateTime.UtcNow.TimeOfDay.ToString() + "</time><url>" + HttpContext.Current.Request.Url + "</url><exception>" + ex.ToString() + "</exception></crash>");
}
but it doesn't appear to allow me to respond to the request with a page.