Page Refresh after download
Posted on 2004-04-06
I have a page that shows a RadioButtonList associated with a list of files available for the user to download. The list is databound to an array that I created using the Directory.GetFiles() method.
Once the user selects a file, they can click a button to download that file using the Respose.WriteFile method. Once the file is downloaded I want to move it from it's current directory on the server to a subdirectory called "deleted" and refresh the page. Everything seems to work fine except I cannot get the page to refresh, so the file that is no longer available is still displayed. This is no good. Any ideas what I am doing wrong here?
//get file and send to client
ListItem liFile = rbFiles.Items[rbFiles.SelectedIndex];
Response.AppendHeader("content-disposition", "attachment; filename=" + liFile.Text);
Response.ContentType = "application/x-msdownload";
//move file to deleted subdir
strSourcePath = Constants.FILE_SOURCE_PATH;
string strDestPath = strSourcePath + "\\deleted";
File.Move(liFile.Value, strDestPath + "\\" + liFile.Text);
//refresh the page
Any help is greatly appreciated.