怎样判断一个运行的ASP.NET程序是 Degug模式还是Release模式

// in AssemblyInfo.cs:
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif

private string buildMode=String.Empty;
private void Page_Load(object sender, System.EventArgs e)
{
     Assembly asm = Assembly.GetExecutingAssembly(); 
     object[] objArray=asm.GetCustomAttributes(false) ;
     foreach (object obj in objArray) 
     {
          AssemblyConfigurationAttribute conf = obj as AssemblyConfigurationAttribute;
     if (conf != null) 
          this.buildMode=conf.Configuration ;
}
Response.Write("Build Mode: " +this.buildMode);
}

你可能感兴趣的:(asp.net)