I would simply like to do something as follows:
var defaultRedirectUrl = SomeMethodToGetDefaultRedirect();
<customErrors mode="On" defaultRedirect="~/Error"/>
Thanx mark, it was helpful. What I really wanted to ask was "how to get "defaultRedirect" property of customErrors section from web.config of my asp mvc app?".
And the answer, based on your post is:
CustomErrorsSection customErrorsSection = (CustomErrorsSection) ConfigurationManager.GetSection("system.web/customErrors"); string defaultRedirect = customErrorsSection.DefaultRedirect;