public static bool IsWebInDebugMode
{
get
{
bool _isDebug = false;
if(HttpContext.Current.Cache["IsDebug"]==null)
{
XmlDocument _doc = new XmlDocument();
string _cfgfile = HttpContext.Current.Server.MapPath("~/Web.Config");
_doc.Load(_cfgfile);
XmlNode _node = _doc.SelectSingleNode("configuration/system.web/compilation");
if(_node==null || _node.Attributes["debug"]==null ||
_node.Attributes["debug"].Value.ToLower()!="true")
{
_isDebug = false;
}
else
{
_isDebug = true;
}
HttpContext.Current.Cache.Insert("IsDebug", _isDebug,
new System.Web.Caching.CacheDependency(_cfgfile),
DateTime.Now.AddDays(1),
TimeSpan.Zero);
}
else
{
_isDebug = bool.Parse(HttpContext.Current.Cache["IsDebug"].ToString());
}
return _isDebug;
}
}