A
Alphonse Giambrone
I have a small asp.net web app running on a shared host.
It uses a Jet (Access) database. I included a routine to compact the
database when the application_event fires if it has not been compacted for a
certain period of time.
A compact must be done into a new file. In other words mydb.mdb compacts
into mydb2.mdb.
The original file (mydb.mdb) then gets deleted and mydb2.mdb is renamed to
mydb.mdb. This routine works fine on another shared host.
On the shared host in question, I receive the error 'Access to the path
....mydb.mdb is denied' when trying to delete the file.
Tech support told me it was because I uploaded the file (mydb.mdb) via ftp
(or FrontPage) and it was therefore owned by the site owner account and not
the aspnet user account. Therefore the aspnet account did not have
permission to delete the file. That I should upload the file via script.
Ok, so I created an aspx page to upload the file > same problem.
I created an aspx page with a single button to run the code to perform the
compact and it works fine, repeatedly.
Unless, the routine has been run from the application_end event and when it
failed, it left behind the file mydb2.mdb.
In that case I receive the same error, except referring to the file
mydb2.mdb, which must be deleted before performing the compact.
So, it appears that if a file is created while the app is running, it can't
be deleted at app_end AND if a file is created at app_end it can't be
deleted when the app is running.
I do understand that once application_end fires, the request, response,
server, etc. objects are no longer valid.
Is it possible that once application_end fires a different user account
takes over from the aspnet account?? This would explain my dilemma.
TIA
It uses a Jet (Access) database. I included a routine to compact the
database when the application_event fires if it has not been compacted for a
certain period of time.
A compact must be done into a new file. In other words mydb.mdb compacts
into mydb2.mdb.
The original file (mydb.mdb) then gets deleted and mydb2.mdb is renamed to
mydb.mdb. This routine works fine on another shared host.
On the shared host in question, I receive the error 'Access to the path
....mydb.mdb is denied' when trying to delete the file.
Tech support told me it was because I uploaded the file (mydb.mdb) via ftp
(or FrontPage) and it was therefore owned by the site owner account and not
the aspnet user account. Therefore the aspnet account did not have
permission to delete the file. That I should upload the file via script.
Ok, so I created an aspx page to upload the file > same problem.
I created an aspx page with a single button to run the code to perform the
compact and it works fine, repeatedly.
Unless, the routine has been run from the application_end event and when it
failed, it left behind the file mydb2.mdb.
In that case I receive the same error, except referring to the file
mydb2.mdb, which must be deleted before performing the compact.
So, it appears that if a file is created while the app is running, it can't
be deleted at app_end AND if a file is created at app_end it can't be
deleted when the app is running.
I do understand that once application_end fires, the request, response,
server, etc. objects are no longer valid.
Is it possible that once application_end fires a different user account
takes over from the aspnet account?? This would explain my dilemma.
TIA