Is it possible to check weather custom errors is turned on or off in the code on web application runtime.
+2
A:
You can use WebConfigurationManager.OpenWebConfiguration to obtain the configuration for the website, then use that to get the custom errors block:
Configuration configuration =
WebConfigurationManager.OpenWebConfiguration(null);
CustomErrorsSection customErrorsSection =
configuration.GetSection("system.web/customErrors") as CustomErrorsSection;
Response.Write(customErrorsSection.Mode.ToString());
Programming Hero
2009-09-02 13:25:33
+1
A:
I've figured out how to do it it's in...
HttpContext.Current.IsCustomErrorEnabled
Naz
2009-09-02 14:47:10