怎样判断一个运行的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);
}

posted @ 2009-03-16 15:01  码尔代夫iimax  阅读(814)  评论(0编辑  收藏  举报