Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could create a <code>FileSystemWatcher</code> in global.ascx then bubble up (update a js for instance) an exception when a file is updated. You could start with this:</p> <pre><code>using System.IO; namespace WebApplication1 { public class Global : System.Web.HttpApplication { FileSystemWatcher watcher; void Application_Start(object sender, EventArgs e) { // Code that runs on application startup watcher = new FileSystemWatcher(this.Context.Server.MapPath("/")); watcher.Changed += new FileSystemEventHandler(watcher_Changed); } void watcher_Changed(object sender, FileSystemEventArgs e) { //set a value in js file FileInfo jsFilesChanged = new FileInfo(Path.Combine(this.Context.Server.MapPath("/"), "scripts", "files_changed.js")); using (StreamWriter jsWriter = (!jsFilesChanged.Exists) ? new StreamWriter(jsFilesChanged.Create()) : new StreamWriter(jsFilesChanged.FullName, false)) { jsWriter.WriteLine("var changed_file = \"" + e.Name + "\";"); } } //....... } } </code></pre> <p>Then in client code include <code>files_changed.js</code> and create a periodic timeout call to check the <code>var changed_file</code>. Also, make sure <code>watcher</code> doesn't get garbage collected. </p> <p>Some references: <a href="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx</a></p> <p><a href="http://www.developerfusion.com/article/84362/extending-filesystemwatcher-to-aspnet/" rel="nofollow">http://www.developerfusion.com/article/84362/extending-filesystemwatcher-to-aspnet/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload