event-log

Find out username(who) modified file in C#

偶尔善良 提交于 2019-11-26 12:15:35
问题 I am using a FileSystemWatcher to monitor a folder. But when there is some event happening in the directory, I don\'t know how to search who made a impact on that file. I tried to use EventLog. It just couldn\'t work. Is there another way to do it? 回答1: I cant remember where I found this code but its an alternative to using pInvoke which I think is a bit overkill for this task. Use the FileSystemWatcher to watch the folder and when an event fires you can work out which user made the file

Write to Windows Application Event Log

女生的网名这么多〃 提交于 2019-11-26 08:48:08
问题 Is there a way to write to this event log: Or at least, some other Windows default log, where I don\'t have to register an event source ? 回答1: Yes, there is a way to write to the event log you are looking for. You don't need to create a new source, just simply use the existent one, which often has the same name as the EventLog's name and also, in some cases like the event log Application, can be accessible without administrative privileges*. *Other cases, where you cannot access it directly,

How to create Windows EventLog source from command line?

两盒软妹~` 提交于 2019-11-26 06:54:38
问题 I\'m creating an ASP.NET application that will log some stuff to Windows EventLog. To do this an event source has to be created first. This requires administrative priviledges so I cannot do it in the ASP.NET app. Is there an existing command-line application that is bundled with Windows that can create an event log source, or must I roll out my own? 回答1: Try "eventcreate.exe" An example: eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO MYEVENTSOURCE /D "My first log" This will create a

System.Security.SecurityException when writing to Event Log

血红的双手。 提交于 2019-11-26 04:34:43
问题 I’m working on trying to port an ASP.NET app from Server 2003 (and IIS6) to Server 2008 (IIS7). When I try and visit the page on the browser I get this: Server Error in ‘/’ Application. Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file. Exception Details: System.Security