----------------------------------------------------------- New Message on cochindotnet
----------------------------------------------------------- From: BachiGuddi1 Message 7 in Discussion Dear mathew, I was able to use FileSystemWatcher class ( suggested by u ) to monitor events in a particular folder from ASP.net ! . ( Net is full of samples how u can do the stuff for WinForm APPs ). In the Global class (derived from System.Web.HttpApplication ) found in the Global.asax i added following code snippets ( in the Application_start method ) // filename is a static variable to pass the fully qaulified path name to a static method. // from a static method we cannot call server.mappath filename = Server.MapPath("log.txt"); StreamWriter sw = new StreamWriter(filename); sw.Write("------------------------------------\n"); sw.Close(); // in the Web.config file i added an entry in appSettings tag //<appSettings> //<add key="monitorpath" value="C:\FileSystemShare"/> //</appSettings> String PathToMonitor = System.Configuration.ConfigurationSettings.AppSettings["monitorpath"]; // create an instance of FileSystemWatcher object and assign path to monitor // set necessary filters FileSystemWatcher watcher = new FileSystemWatcher(); watcher.Path = PathToMonitor; watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName; // Only watch excel files watcher.Filter = "*.xls"; watcher.Changed += new FileSystemEventHandler(OnChanged); watcher.EnableRaisingEvents = true; OnChanged event handler will look like this /////////////////////////////////////////////////////////// // // Do Whatever u want here. I am just logging the // info into the file. // // private static void OnChanged(object source, FileSystemEventArgs e) { StreamWriter w = File.AppendText(filename); w.Write("File Changed "+ e.ToString()); w.Close(); } Praseed Pai ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/cochindotnet/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]