I need to read from the security log in windows, but the user will not have the administrative permissions to do so, and the application will throw an exception,
EventLog[] a = EventLog.GetEventLogs();
foreach (var item in a)
{
if (item.Log == "Security")
{
foreach (EventLogEntry item2 in item.Entries)//The exception thrown here
{
//TODO
}
}
}
I just want to read, I don't want to write anything. How to gain access to these entries without those permissions?
There is a possibility but it requires extensive steps by a qualified Administrator to set up the necessary rights. For more info, see http://blogs.technet.com/b/janelewis/archive/2010/04/30/giving-non-administrators-permission-to-read-event-logs-windows-2003-and-windows-2008.aspx.
If you do not explicitly get rights to read, you cannot -- that is the whole point of DRM.