I don't manage to use a Response.Redirect (or Response.Write) on a new FileSystemWatcher event.
protected void Page_Load(object sender, EventArgs e)
{
RunFolderListener();
}
private void RunFolderListener()
{
FileSystemWatcher fsw = new FileSystemWatcher();
fsw.Path = Server.MapPath("~/uploaded_images/");
fsw.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite |
NotifyFilters.DirectoryName | NotifyFilters.FileName;
fsw.Changed += new FileSystemEventHandler(OnChanged);
fsw.EnableRaisingEvents = true;
}
private void OnChanged(object source, FileSystemEventArgs e)
{
Response.Redirect(....); //not working
Response.Write (....);//not working
}