private bool CheckForSqlException(Exception exception, IResourceStrings resources) { if (exception == null) { return(false); } if (exception.StackTrace.Contains("System.Data.SqlClient")) { return(true); } // ASP.NET samples need an extra check because we actually create a web request internally // to get the rendered source of those samples so we have to check the response of the // original web request of the sample WebException webEx = exception as WebException; if (webEx != null) { string content; using (StreamReader sr = new StreamReader(webEx.Response.GetResponseStream())) { content = sr.ReadToEnd(); } if (content.Contains(new SqlErrorViewModel(resources).Heading)) { return(true); } } if (exception.InnerException != null) { return(CheckForSqlException(exception.InnerException, resources)); } return(false); }
public AppUrlHelper(IFileSystem fs, IResourceStrings resources) : base(fs, resources) { }
private bool CheckForSqlException(Exception exception, IResourceStrings resources) { if (exception == null) return false; if (exception.StackTrace.Contains("System.Data.SqlClient")) { return true; } // ASP.NET samples need an extra check because we actually create a web request internally // to get the rendered source of those samples so we have to check the response of the // original web request of the sample WebException webEx = exception as WebException; if (webEx != null) { string content; using (StreamReader sr = new StreamReader(webEx.Response.GetResponseStream())) { content = sr.ReadToEnd(); } if (content.Contains(new SqlErrorViewModel(resources).Heading)) { return true; } } if (exception.InnerException != null) { return CheckForSqlException(exception.InnerException, resources); } return false; }