On the page is a counter that tells them how many files are in their folder.
When you delete a file from the folder using ASP.NET, it seems to send a
command off to delete the file and keeps processing the page... the page
reloads, but the file count of the folder doesn't change because it seems
that the page rendering is faster than the file deletion.
Is there any way to get around this?How do you delete files and how do you update the count?
Eliyahu
"Diggler" <Diggler@.discussions.microsoft.com> wrote in message
news:B0BB8CB7-626F-4969-A6D6-F773EA83FF3D@.microsoft.com...
> I have a web application that allows a user to manage files on the server.
> On the page is a counter that tells them how many files are in their
folder.
> When you delete a file from the folder using ASP.NET, it seems to send a
> command off to delete the file and keeps processing the page... the page
> reloads, but the file count of the folder doesn't change because it seems
> that the page rendering is faster than the file deletion.
> Is there any way to get around this?
hi
try to make sleep thread for a little time before deleting the file.
include System.Threading and add in you code
Thread.Sleep(100);
Or Just keep in viewstate the last number of files before delete and just
decrement with 1 your file number.
Cheers
"Diggler" wrote:
> I have a web application that allows a user to manage files on the server.
> On the page is a counter that tells them how many files are in their folder.
> When you delete a file from the folder using ASP.NET, it seems to send a
> command off to delete the file and keeps processing the page... the page
> reloads, but the file count of the folder doesn't change because it seems
> that the page rendering is faster than the file deletion.
> Is there any way to get around this?
I use the FileInfo object to delete the file, they are all stored in a
FileInfo[] array.
I get the count by using the IMessages interface, since these are email
messages and I have to read the headers for each file... so I use the
IMessages.Count property.
"Eliyahu Goldin" wrote:
> How do you delete files and how do you update the count?
> Eliyahu
> "Diggler" <Diggler@.discussions.microsoft.com> wrote in message
> news:B0BB8CB7-626F-4969-A6D6-F773EA83FF3D@.microsoft.com...
> > I have a web application that allows a user to manage files on the server.
> > On the page is a counter that tells them how many files are in their
> folder.
> > When you delete a file from the folder using ASP.NET, it seems to send a
> > command off to delete the file and keeps processing the page... the page
> > reloads, but the file count of the folder doesn't change because it seems
> > that the page rendering is faster than the file deletion.
> > Is there any way to get around this?
>
Deleting with FileInfo is fine, it should delete file immediatly. I am not
familiar with IMessages. If you use something like DirectoryInfo.GetFiles()
you should get the right result.
Eliyahu
"Diggler" <Diggler@.discussions.microsoft.com> wrote in message
news:1B48A926-8233-4525-A225-C8A13E82BE44@.microsoft.com...
> I use the FileInfo object to delete the file, they are all stored in a
> FileInfo[] array.
> I get the count by using the IMessages interface, since these are email
> messages and I have to read the headers for each file... so I use the
> IMessages.Count property.
> "Eliyahu Goldin" wrote:
> > How do you delete files and how do you update the count?
> > Eliyahu
> > "Diggler" <Diggler@.discussions.microsoft.com> wrote in message
> > news:B0BB8CB7-626F-4969-A6D6-F773EA83FF3D@.microsoft.com...
> > > I have a web application that allows a user to manage files on the
server.
> > > On the page is a counter that tells them how many files are in their
> > folder.
> > > When you delete a file from the folder using ASP.NET, it seems to
send a
> > > command off to delete the file and keeps processing the page... the
page
> > > reloads, but the file count of the folder doesn't change because it
seems
> > > that the page rendering is faster than the file deletion.
> > > > Is there any way to get around this?
No, that didn't work. I call two different methods...
DeleteFiles() and then
PopulateDataGrid().
DeleteFiles runs first, deletes the file(s) and I changed the code in
PopulateDataGrid to read the directory using DirectoryInfo.GetFiles(). I
think the code is running faster than the delete.
"Eliyahu Goldin" wrote:
> Deleting with FileInfo is fine, it should delete file immediatly. I am not
> familiar with IMessages. If you use something like DirectoryInfo.GetFiles()
> you should get the right result.
> Eliyahu
> "Diggler" <Diggler@.discussions.microsoft.com> wrote in message
> news:1B48A926-8233-4525-A225-C8A13E82BE44@.microsoft.com...
> > I use the FileInfo object to delete the file, they are all stored in a
> > FileInfo[] array.
> > I get the count by using the IMessages interface, since these are email
> > messages and I have to read the headers for each file... so I use the
> > IMessages.Count property.
> > "Eliyahu Goldin" wrote:
> > > How do you delete files and how do you update the count?
> > > > Eliyahu
> > > > "Diggler" <Diggler@.discussions.microsoft.com> wrote in message
> > > news:B0BB8CB7-626F-4969-A6D6-F773EA83FF3D@.microsoft.com...
> > > > I have a web application that allows a user to manage files on the
> server.
> > > > On the page is a counter that tells them how many files are in their
> > > folder.
> > > > When you delete a file from the folder using ASP.NET, it seems to
> send a
> > > > command off to delete the file and keeps processing the page... the
> page
> > > > reloads, but the file count of the folder doesn't change because it
> seems
> > > > that the page rendering is faster than the file deletion.
> > > > > > Is there any way to get around this?
> > > >
Very strange. Are you sure the delete works in the first place?
Eliyahu
"Diggler" <Diggler@.discussions.microsoft.com> wrote in message
news:8DCE1CBC-0990-4F30-8B2C-4F318EF7FC30@.microsoft.com...
> No, that didn't work. I call two different methods...
> DeleteFiles() and then
> PopulateDataGrid().
> DeleteFiles runs first, deletes the file(s) and I changed the code in
> PopulateDataGrid to read the directory using DirectoryInfo.GetFiles(). I
> think the code is running faster than the delete.
> "Eliyahu Goldin" wrote:
> > Deleting with FileInfo is fine, it should delete file immediatly. I am
not
> > familiar with IMessages. If you use something like
DirectoryInfo.GetFiles()
> > you should get the right result.
> > Eliyahu
> > "Diggler" <Diggler@.discussions.microsoft.com> wrote in message
> > news:1B48A926-8233-4525-A225-C8A13E82BE44@.microsoft.com...
> > > I use the FileInfo object to delete the file, they are all stored in a
> > > FileInfo[] array.
> > > > I get the count by using the IMessages interface, since these are
email
> > > messages and I have to read the headers for each file... so I use the
> > > IMessages.Count property.
> > > > "Eliyahu Goldin" wrote:
> > > > > How do you delete files and how do you update the count?
> > > > > > Eliyahu
> > > > > > "Diggler" <Diggler@.discussions.microsoft.com> wrote in message
> > > > news:B0BB8CB7-626F-4969-A6D6-F773EA83FF3D@.microsoft.com...
> > > > > I have a web application that allows a user to manage files on the
> > server.
> > > > > On the page is a counter that tells them how many files are in
their
> > > > folder.
> > > > > When you delete a file from the folder using ASP.NET, it seems to
> > send a
> > > > > command off to delete the file and keeps processing the page...
the
> > page
> > > > > reloads, but the file count of the folder doesn't change because
it
> > seems
> > > > > that the page rendering is faster than the file deletion.
> > > > > > > > Is there any way to get around this?
> > > > > >
I am abolutely sure. I keep the folder containing the file open while
deleting, and watch the file disappear. The page usually displays before the
file disappears. I theorize that the framework sends a message to the
operating system to 'delete this file' then returns immediately, allowing the
OS to take care of the actual delete.
"Eliyahu Goldin" wrote:
> Very strange. Are you sure the delete works in the first place?
> Eliyahu
> "Diggler" <Diggler@.discussions.microsoft.com> wrote in message
> news:8DCE1CBC-0990-4F30-8B2C-4F318EF7FC30@.microsoft.com...
> > No, that didn't work. I call two different methods...
> > DeleteFiles() and then
> > PopulateDataGrid().
> > DeleteFiles runs first, deletes the file(s) and I changed the code in
> > PopulateDataGrid to read the directory using DirectoryInfo.GetFiles(). I
> > think the code is running faster than the delete.
> > "Eliyahu Goldin" wrote:
> > > Deleting with FileInfo is fine, it should delete file immediatly. I am
> not
> > > familiar with IMessages. If you use something like
> DirectoryInfo.GetFiles()
> > > you should get the right result.
> > > > Eliyahu
> > > > "Diggler" <Diggler@.discussions.microsoft.com> wrote in message
> > > news:1B48A926-8233-4525-A225-C8A13E82BE44@.microsoft.com...
> > > > I use the FileInfo object to delete the file, they are all stored in a
> > > > FileInfo[] array.
> > > > > > I get the count by using the IMessages interface, since these are
> email
> > > > messages and I have to read the headers for each file... so I use the
> > > > IMessages.Count property.
> > > > > > "Eliyahu Goldin" wrote:
> > > > > > > How do you delete files and how do you update the count?
> > > > > > > > Eliyahu
> > > > > > > > "Diggler" <Diggler@.discussions.microsoft.com> wrote in message
> > > > > news:B0BB8CB7-626F-4969-A6D6-F773EA83FF3D@.microsoft.com...
> > > > > > I have a web application that allows a user to manage files on the
> > > server.
> > > > > > On the page is a counter that tells them how many files are in
> their
> > > > > folder.
> > > > > > When you delete a file from the folder using ASP.NET, it seems to
> > > send a
> > > > > > command off to delete the file and keeps processing the page...
> the
> > > page
> > > > > > reloads, but the file count of the folder doesn't change because
> it
> > > seems
> > > > > > that the page rendering is faster than the file deletion.
> > > > > > > > > > Is there any way to get around this?
> > > > > > > > > > > > >
0 comments:
Post a Comment