我無法在新的FileSystemWatcher事件上使用Response.Redirect(或Response.Write)。在FileSystemWatcher事件上的ASP.net Response.Redirect
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
}
是你的onChanged方法嗎? – MUG4N 2010-09-09 08:13:56
是的。它被稱爲。 – Ranch 2010-09-09 08:23:00