从共享文件夹中删除文件时获取IP地址 [英] Get IP Address when Deleting Files from Share Folder

查看:131
本文介绍了从共享文件夹中删除文件时获取IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试跟踪从我的共享文件夹中删除文件的IP地址。我写了一个代码来获取信息,当我尝试在我的共享文件夹中执行某些操作但是,我无法从删除事件发生的位置获取IP。



这是我的代码:



I am trying to trace IP-Address who is deleting files from my share folders. I have write a code to get information when trying to do something in my share folder but, I can't get the IP from where the delete event's is occurred.

Here is my Code:

private void Form1_Load(object sender, EventArgs e)
        {
            FileSystemWatcher fsw = new FileSystemWatcher();
            fsw.Path = @"E:\Mahbub IT\";
            fsw.EnableRaisingEvents = true;
            fsw.Filter = "*.*";
            fsw.IncludeSubdirectories = true;
            fsw.Created += new FileSystemEventHandler(file_handler_function);
            fsw.Changed += new FileSystemEventHandler(file_handler_function);
            fsw.Deleted += new FileSystemEventHandler(file_handler_function);
            fsw.Renamed += new RenamedEventHandler(file_rename_handler_function);
        }

private void file_handler_function(object sender, FileSystemEventArgs e)
        {
            if (e.ChangeType == WatcherChangeTypes.Created)
            {
                MessageBox.Show("New file created : " + e.FullPath);
            }
            else if (e.ChangeType == WatcherChangeTypes.Deleted)
            {
                MessageBox.Show("File is deleted : " + e.FullPath);
                //MessageBox.Show(Request.UserHostAddress);
            }
            else if (e.ChangeType == WatcherChangeTypes.Changed)
            {
                MessageBox.Show("File modified : " + e.FullPath);
            }
        }



这个工作正常,但我想在MessageBox.Show中添加IP地址(Client :: IP )。



谢谢你提前。

推荐答案





你可以试试这个: http://stackoverflow.com/questions/11660235/find-out-usernamewho-modified-file- in-c-sharp [ ^ ]



我没试过,看看会发生什么......



或者你可以尝试一种非常擅长这种工作的付费产品: https:/ /www.eldos.com/cbflt/index.php#product [ ^ ]



谢谢

Suvabrata
Hi,

You can try this : http://stackoverflow.com/questions/11660235/find-out-usernamewho-modified-file-in-c-sharp[^]

I did not try it let see what happen...

Or Else you can try a paid product which is very good at this kind of work : https://www.eldos.com/cbflt/index.php#product[^]

Thanks
Suvabrata


而不是使用Windows操作系统的共享文件夹,创建自己的服务,负责s haring:然后你可以监控所有事情。
Instead of using a Shared Folder of the Windows Operating System, create your own service which takes care of the sharing: then you can monitor everything.


一遍又一遍地停止重新发布同一个问题并发送垃圾论坛。
Stop reposting the same question over and over again and spamming the forums.


这篇关于从共享文件夹中删除文件时获取IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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