Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7595499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:41:12+00:00 2026-05-30T21:41:12+00:00

I am building a .NET WinForms based application (currently using .NET 3.5). The application

  • 0

I am building a .NET WinForms based application (currently using .NET 3.5).

The application writes/reads from files in certain scenarios.

I would like to be able to trace all these file writing activities (i would like the application to only write to files under its own folder, and not to any other folders such as C:\Temp)

Is there any easy way i could “sniff” on this activity and see which files are being written to (along with the stack trace perhaps)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:41:13+00:00Added an answer on May 30, 2026 at 9:41 pm

    Have you tried maybe FileSystemWatcher class?

    It want give you full stack trace, but you will have at least information about writing with quite simple api.

    From MSDN:

    using System;
    using System.IO;
    
    class Program
    {
        static void Main(string[] args)
        {
            //  Create a FileSystemWatcher to monitor all files on drive C.
            FileSystemWatcher fsw = new FileSystemWatcher("C:\\");
    
            //  Watch for changes in LastAccess and LastWrite times, and
            //  the renaming of files or directories. 
        fsw.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
            | NotifyFilters.FileName |NotifyFilters.DirectoryName;
    
        //  Register a handler that gets called when a 
        //  file is created, changed, or deleted.
        fsw.Changed += new FileSystemEventHandler(OnChanged);
    
        fsw.Created += new FileSystemEventHandler(OnChanged);
    
        fsw.Deleted += new FileSystemEventHandler(OnChanged);
    
        //  Register a handler that gets called when a file is renamed.
        fsw.Renamed += new RenamedEventHandler(OnRenamed);
    
        //  Register a handler that gets called if the 
        //  FileSystemWatcher needs to report an error.
        fsw.Error += new ErrorEventHandler(OnError);
    
        //  Begin watching.
        fsw.EnableRaisingEvents = true;
    
        Console.WriteLine("Press \'Enter\' to quit the sample.");
        Console.ReadLine();
    
    
    }
    
    //  This method is called when a file is created, changed, or deleted.
    private static void OnChanged(object source, FileSystemEventArgs e)
    {
        //  Show that a file has been created, changed, or deleted.
        WatcherChangeTypes wct = e.ChangeType;
        Console.WriteLine("File {0} {1}", e.FullPath, wct.ToString());
    }
    
    //  This method is called when a file is renamed.
    private static void OnRenamed(object source, RenamedEventArgs e)
    {
        //  Show that a file has been renamed.
        WatcherChangeTypes wct = e.ChangeType;
        Console.WriteLine("File {0} {2} to {1}", e.OldFullPath, e.FullPath, wct.ToString());
    }
    
    //  This method is called when the FileSystemWatcher detects an error.
    private static void OnError(object source, ErrorEventArgs e)
    {
        //  Show that an error has been detected.
        Console.WriteLine("The FileSystemWatcher has detected an error");
        //  Give more information if the error is due to an internal buffer overflow.
        if (e.GetException().GetType() == typeof(InternalBufferOverflowException))
        {
            //  This can happen if Windows is reporting many file system events quickly 
            //  and internal buffer of the  FileSystemWatcher is not large enough to handle this
            //  rate of events. The InternalBufferOverflowException error informs the application
            //  that some of the file system events are being lost.
            Console.WriteLine(("The file system watcher experienced an internal buffer overflow: " + e.GetException().Message));
        }
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently building a .Net userform using C# and I am populating it
I'm building a .NET CF 3.5 application that will communicate with an server based
I am building a c# - linq - sql server winforms/asp.net application, accessing a
I'm building ASP.NET MVC2 application, and using Entity Framework as ORM. I am having
I'm busy building a software update application in C#, WinForms, .NET 3.5, where I
I'm building a WinForms application where I'll need it to work locally (just like
I'd like ask a question about building applications in .NET that use data from
I'm in the process of switching from certain open-source technologies to ASP.net for building
I am building a WinForms Application in C# .NET The WinForms Application has a
I'm currently building a .net web application that uses WCF web services to allow

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.