Skip to content

Instantly share code, notes, and snippets.

@milannankov
Last active March 8, 2017 08:46
Show Gist options
  • Save milannankov/81f3295827e9d9fd9cfd5c7e13c6a408 to your computer and use it in GitHub Desktop.
Save milannankov/81f3295827e9d9fd9cfd5c7e13c6a408 to your computer and use it in GitHub Desktop.
Disable or Enable Application Insights For Multiple Environments
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
InitAppInsights();
}
private static void InitAppInsights()
{
// Add AppInsights:InstrumentationKey appSetting to web.config
// <add key="AppInsights:InstrumentationKey" value="" />
TelemetryConfiguration.Active.InstrumentationKey =
ConfigurationManager.AppSettings["AppInsights:InstrumentationKey"];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment