源码如下:
//log file string logDetails=null; if (HttpContext.Current.Session["userInfo"]==null)
{
logDetails=ClientInfo.ClientTotalInfo+logDetail;
}
else
{
logDetails=ClientInfo.ClientTotalInfo+"用户名:"+((UserInfo)(HttpContext.Current.Session["userInfo"])).UserName+'\n'+logDetail;
}

EventLog el=new EventLog("勇进日志");
el.Source=logSource.ToString(); switch( logType )
{
case LogType.Error:
// Write an 'Error' entry in specified log of event log.
el.WriteEntry(logDetails,EventLogEntryType.Error);
break;
case LogType.Warning:
// Write a 'Warning' entry in specified log of event log.
el.WriteEntry(logDetails,EventLogEntryType.Warning);
break;
case LogType.Information:
// Write an 'Information' entry in specified log of event log.
el.WriteEntry(logDetails,EventLogEntryType.Information);
break;
case LogType.FailureAudit:
// Write a 'FailureAudit' entry in specified log of event log.
el.WriteEntry(logDetails,EventLogEntryType.FailureAudit);
break;
case LogType.SuccessAudit:
// Write a 'SuccessAudit' entry in specified log of event log.
el.WriteEntry(logDetails,EventLogEntryType.SuccessAudit);
break;
default:
throw new Exception("参数类型错误");
//break;
}错误:
运行时如下错误(调试时2000机器好用,xp机器不好用)
安全性异常 
说明: 应用程序试图执行安全策略不允许的操作。要授予此应用程序所需的权限,请与系统管理员联系,或在配置文件中更改该应用程序的信任级别。 异常详细信息: System.Security.SecurityException: 不允许所请求的注册表访问权。源错误: 
行 46:  case LogType.Information:
行 47:  // Write an 'Information' entry in specified log of event log.
行 48:  el.WriteEntry(logDetails,EventLogEntryType.Information);
行 49:  break;
行 50:  case LogType.FailureAudit:
 源文件: c:\inetpub\wwwroot\yj\util\writeeventlog.cs    行: 48 堆栈跟踪: 
[SecurityException: 不允许所请求的注册表访问权。] 
请各位大虾指教