Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello
I would love to be able to determine wether a site is running in DEBUG mode or not. Is there anyway to check this?
Here is an example that hopefully shows the general idea:
if (umbracoDebugMode == true) { @Html.Raw("app.js"); } else { @Html.Raw("app.min.js"); }
Thanks
Hi Niels
Of course you can do it.
I don't know internal method for it, but you can do it like:
if (bool.Parse(ConfigurationManager.AppSettings["umbracoDebugMode"]) == true) { @Html.Raw("app.js"); } else { @Html.Raw("app.min.js"); }
Thanks,
Alex
Another way is to use System.Diagnostics, something like:
NameSpace:
using System.Resources; using System.Diagnostics;
Method:
private static bool IsDebug() { object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(DebuggableAttribute), false); if ((customAttributes != null) && (customAttributes.Length == 1)) { DebuggableAttribute attribute = customAttributes[0] as DebuggableAttribute; return (attribute.IsJITOptimizerDisabled && attribute.IsJITTrackingEnabled); } return false; }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Test wether a env. is running with debug mode?
Hello
I would love to be able to determine wether a site is running in DEBUG mode or not. Is there anyway to check this?
Here is an example that hopefully shows the general idea:
Thanks
Hi Niels
Of course you can do it.
I don't know internal method for it, but you can do it like:
Thanks,
Alex
Another way is to use System.Diagnostics, something like:
NameSpace:
Method:
is working on a reply...