November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
As Valdis are saying the best way to handle this is in web.config with customerrors and httperrors.
https://docs.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/
Why do you not want to use the built in and proved effective solution with httperrors?
Hello,
As such there is no issue in using built in solution.
Actullay I am handling exception in global.asax file like
protected void Application_Error(object sender, EventArgs e)
{
//Get error page url
var baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/');
var contentReference = new ContentReference(2664);
var url = ServiceLocator.Current.GetInstance<IContentRepository>().Get<CustomErrorPage>(contentReference).LinkURL;
var completeUrl = baseUrl + url;
//Global Exception handling
Exception exception = Server.GetLastError();
Server.ClearError();
Logger.Error(exception);
Response.Redirect(completeUrl);
}
I am to handle all exception but If server is down then this approach gets fail.
Any ways I can go with customErrors approach also.
"server is down"? you mean no network access for it? there is great magnitude of edge cases what could possibly go wrong and how to hande.
Your biggest problem is that you are trying to show a Episerver page when you get an error and for examle if the SQL is down, this line will throw it's own error since it can not talk to the database.
var url = ServiceLocator.Current.GetInstance<IContentRepository>().Get<CustomErrorPage>(contentReference).LinkURL;
A page for 500-error should never be a dynamic page, it should always be static.
Hi,
I am handling episerver application exceptions in global.asax file. Whenever any exception occur it redirects to 404 error page and exception get log in text file.
But when the SQL server is down it shows an sql server exception on page and does not redirect it to error page.
So how can I handle such types of exceptions in episerver.
Example of SQL server exception
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)