可以录制UNC连接? [英] can record unc connection?

查看:291
本文介绍了可以录制UNC连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的电脑有一个UNC文件。我在与其他人的网络。
每隔可以通过ADRESS线\\file倾翻打开该文件。

The Pc I use have an UNC file. I'm in a Network with other people. Every other can open the file by tipping in the adress line \\file.

知道我要来写VS2010 C#PROGRAMM其监视文件我用的Win7 32位。如果任何一个打开PROGRAMM应在日志文件中已经有人打开我的文件写入文件。

Know I want to write a c# programm in Vs2010 which watch over the file I use Win7 32bit. If any one Open the file the programm shall write in a Logfile that someone has open my file.

我试图用FileSystemWatcher对象但这只是更改外观/省/ cration但不能用于开幕。

I tried to use the FileSystemWatcher but this only look for changes/saves/cration but not for Opening.

我也读到了审核财产以后,而且我能够做到这一点(好我的UNC文件)本(审计) 。但我试图找出如何在C#中使用审核,但我发现并不多。

I read somthing about "auditing" and that I'm be able to do that(watch over my unc file) with this(auditing).But i tried to find out how to use auditing in c# but i found not much.

所以我的问题:

是否有可能做我想做与审计

Is it possible to do what i want with "auditing" ?

是不是有人工作在C#中的审计befor或有任何链接或somtihng给我看它是如何工作在C#?

Did someone worked with auditing in c# befor or has anyone a link or somtihng to show me how it works in c#?

制造山姆

Sry基因的英语不好

Sry for bad english

推荐答案

您可能需要使用的审核对象访问

你必须要遵循的步骤:


  1. 启用 审核对象访问 本地计算机策略

  2. 启用要效仿的对象审核。

  3. 从应用程序中使用 EventLog.EntryWritten事件来检测该文件开幕活动

  1. Enable the Audit object access in the Local Computer Policy.
  2. Enable auditing for the object you want to follow.
  3. From your application, use the EventLog.EntryWritten Event to detect the file opening event

下面是一个简单的示例用法,但你必须在文档中挖为了捕捉和日志,因为你需要:

Here's a simplistic sample usage, but you'll have to dig in the documentation in order to capture and log as you need to:

class Program
{
    public static void Main()
    {

        EventLog myNewLog = new EventLog("Security", ".", "Microsoft Windows security");

        myNewLog.EntryWritten += new EntryWrittenEventHandler(MyOnEntryWritten);
        myNewLog.EnableRaisingEvents = true;

        Console.ReadLine();
    }

    public static async void MyOnEntryWritten(object source, EntryWrittenEventArgs e)
    {
        await Task.Factory.StartNew(() =>
        {
            if (e.Entry.InstanceId == 4656 || e.Entry.InstanceId == 4663)
            {
                Console.WriteLine(e.Entry.Message);
            }
        });
    }
}

这篇关于可以录制UNC连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆