File Handle not being released with FileInfo.LastWriteTime

D

dotnet_ottawa

From an ASPX page I am trying to access the System.IO.FileInfo.LastWriteTime
property of a file on the web site.

The problem I have is that image file types; e/g/ gif, bmp etc; are not
being released from the FileInfo object. If I access a page that reads the
LastWriteTime of an image file; I cannot then update the file on the web
server, until the app pool recycles.

The same is not true for the text files; e.g. css, js; the FileInfo object
is releasing these files.

I have tried the garbage collector against the FileInfo object instance; but
this did not work.

Using the static System.IO.File object causes the same behaviour, and with
no instance to dispose of.

Does anyone know how to access a file's LastWriteTime [last modified]
property and release the handle?
 
D

dotnet_ottawa

Problem solved.

It was not the file property read that was causing the problem, but a
FileStream object elsewhere in the code that was not closed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top