Problem with a method?
I am a newbie to C# and in the following method:
private void LogToEventLog(string pstrEventLogName)
{
EventLog objEventLog = new EventLog();
if ((!EventLog.SourceExists(pstrEventLogName)))
{
EventLog.CreateEventSource(pstrEventLogName, pstrEventLogName);
}
objEventLog.Source = pstrEventLogName;
try
{
objEventLog.WriteEntry(this.ErrorAsString, EventLogEntryType.Error);
}
catch (Exception ex)
{
throw ex;
}
}
The ERROR is:
The type or namespace name 'EventLog' could not be found (are you missing a using directive or an assembly reference?)
Here are my using statements:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Web.SessionState;
using System.Web;
using System.Configuration;
using System.IO;
using System.Text;
What am I missing?
Any help is appreciated. Thanks.
|