应该是权限问题。服务器是运营商的话,请他们帮你。

解决方案 »

  1.   

    有出错的截图吗上传,不然都是瞎猜
      

  2.   

    放到page之前去运行就可以了
    using System;
    using System.IO;
    using System.Text.RegularExpressions;
    using System.Threading;
    using System.Web;
    using System.Xml;
    using Galsun.Common;
    using Galsun.HH.FCX.Content;
    using Galsun.HH.FCX.Mode;
    using System.Data;
    using System.Management;
    namespace Galsun.HH.FCX.Web.UI
    {
        public class HttpModule : System.Web.IHttpModule
        {
            /// <summary>
            /// 实现接口的Init方法
            /// </summary>
            /// <param name="context"></param>
            public void Init(HttpApplication context)
            {
                GetHardID();
            }
            /// <summary>
            /// 获取硬盘ID
            /// </summary>
            /// <returns>硬盘ID</returns>
            public static string GetHardID()
            {            string HDInfo = "";            ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive");
                ManagementClass cimobject2 = new ManagementClass("Win32_Processor");
                try
                {                ManagementObjectCollection moc1 = cimobject1.GetInstances();                foreach (ManagementObject mo in moc1)
                    {                    HDInfo += (string)mo.Properties["Model"].Value;
                        break;
                    }
                    ManagementObjectCollection moc2 = cimobject2.GetInstances();                foreach (ManagementObject mo in moc2)
                    {                    HDInfo += (string)mo.Properties["Processorid"].Value;
                        break;
                    }
                }
                catch (Exception err)
                {
                    HDInfo = err.ToString();
                }
                if (System.Web.HttpContext.Current.Application["HDInfo"] == null)
                {
                    System.Web.HttpContext.Current.Application.Lock();
                    System.Web.HttpContext.Current.Application["HDInfo"] = HDInfo;
                    System.Web.HttpContext.Current.Application.UnLock();
                }
                return HDInfo;        }        public void Application_OnError(Object sender, EventArgs e)
            {
                HttpApplication application = (HttpApplication)sender;
                HttpContext context = application.Context;
                //if (context.Server.GetLastError().GetBaseException() is MyException)
                {
                    //MyException ex = (MyException) context.Server.GetLastError().GetBaseException();
                    context.Response.Write("<html><body style=\"font-size:14px;\">");
                    context.Response.Write("GL.CMS Error:<br />");
                    context.Response.Write("<textarea name=\"errormessage\" style=\"width:80%; height:200px; word-break:break-all\">");
                    context.Response.Write(System.Web.HttpUtility.HtmlEncode(context.Server.GetLastError().ToString()));
                    context.Response.Write("</textarea>");
                    context.Response.Write("</body></html>");
                    context.Response.End();
                }        }
            /// <summary>
            /// 实现接口的Dispose方法
            /// </summary>
            public void Dispose()
            {        }
        }
    }
    web.config
          <httpModules>
            <add type="Galsun.Easy.Web.UI.Base.HttpModule" name="HttpModule" />
          </httpModules>