This is quite interesting to know that who is accessing your shared folder in network. We can easily get the information of that user and even you can track what is the activity he is doing in your system. We can achieve this using WMI (Windows Management Instrumentation) and MQL ( Management Query Language ) .
For using WMI you need to add one DLL called System.Management.dll and add the namespace as
[sourcecode language="csharp"]
using System.Management
[/sourcecode]
Now Read the current Session of your system.
[sourcecode language="csharp"]
private void Read_Current_Session()
{
try
{
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM Win32_ServerConnection");
foreach (ManagementObject queryObj in searcher.Get())
{
String RemoteIPAddress = queryObj["ComputerName"].ToString();
String RemoteUserName = queryObj["UserName"].ToString();
String RemoteActiveTime = queryObj["ActiveTime"].ToString();
}
}
catch (ManagementException e)
{
MessageBox.Show("WMI Error: " + e.Message);
}
}
[/sourcecode]
Few Years back I have developed one Open Source Tool (NetSpY) based on WMI and MQL. NetSpy (NetWorkSpy) is an Small Windows based application which will continiouly monitor your shared folder in the network and will generate the complete log of the accessing user activities. This can show you the immidiate popup message that who is accessing right now.
If you are interested please have a look over here,
Net Spy: Your Network Spy That Monitor Your System In Network And Generate Log For Any Changes
skip to main |
skip to sidebar
RSS Feeds
Abhijit's World of .NET Blog
Wednesday, October 21, 2009
Labels
- .NET (1)
- .NET 4.0 (10)
- ASP.Net (2)
- ASP.NET (12)
- asp.net 4.0 (2)
- ASP.NET 4.0 (1)
- Awards (2)
- C# (8)
- C# 4.0 (3)
- code (1)
- codeproject (5)
- Debugging (2)
- Enterprise Library 4.1 (1)
- General (21)
- IIS (1)
- IntelliTrace (2)
- Microsoft ASP.NET Web Site (4)
- MSDN (1)
- Multithreaded Debugging (1)
- MVC (1)
- MVC Framework (1)
- MVP (3)
- My Articles (15)
- Parallel Debugging (1)
- RenderingMode (1)
- SQL Server 2005 (6)
- VideoTutorial (1)
- View State (1)
- Visual Studio 2010 (9)
- VS 2010 (1)
- VSX (1)
- Web Services (1)
- WPF (1)
ASP.NET Books
Copyright 2009
Abhijit's Blog. Powered by Blogger
Blogger Showcase - Submit Your Blog Blogger Templates created by Deluxe Templates
Wordpress theme by Site5
Blogger Showcase - Submit Your Blog Blogger Templates created by Deluxe Templates
Wordpress theme by Site5
2 comments:
Can I have this project in Vb.net instead of C#
The code is available on Code Project. So you can download it and convert it on VB.NET. I have implemented it on C#
Post a Comment