File Handle not being released with FileInfo.LastWriteTime

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?


0
Utf
3/11/2010 7:40:01 PM
dotnet.framework.aspnet 1425 articles. 0 followers. Follow

1 Replies
1752 Views

Similar Articles

[PageSpeed] 5

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.



"dotnet_ottawa" wrote:

> 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?
> 
> 
0
Utf
3/11/2010 8:06:01 PM
Reply:

Similar Artilces:

How do I import old Publisher files? #2
I was told to turn off Norton, can you help me? ...

How to auto size jpeg files into excel when import/insert pictures
Is there an add-in that will auto size a picture within a specified area without having to resize it all the time. I'm trying to design my own trading journal and need to import screen shots saved as jpeg file into a specified area. Any help would be greatly appreciated. You need to read, for example, the width of both the range where you are pasting, and the width of the jpg: With ActiveSheet 'Select the cell where the picture is placed Range("rngForJPG").Cells(1,1).Select 'Insert the picture .Pictures.Insert(myImageFileN...

Archiving files
I'm using V11.0 Money 2003. Following the help directions, after entering the date and trying to save to a disc, I'm told "the disc is full" and it will not archive my records to the floppy. I've tried several discs, and shortened the time period to be "archived" and nothing works. Advice please? In microsoft.public.money, Howard wrote: >I'm using V11.0 Money 2003. Following the help >directions, after entering the date and trying to save to >a disc, I'm told "the disc is full" and it will not >archive my records to the ...

WAB DLL file
For some reason I can't get to my address book in outlook. comes up it can't find the WAB DLL file. ???????????????????????????????????????????????????? What version of Outlook installed on what o/s Outlook hasnt used a wab.dll since outlook 2k(?) "Tony Miller" <tonyyamahamiller@comcast.net> wrote in message news:%2346VH1%23qJHA.4260@TK2MSFTNGP06.phx.gbl... > For some reason I can't get to my address book in outlook. > comes up it can't find the WAB DLL file. > ???????????????????????????????????????????????????? let me guess -- outlook 2000 on v...

Password recovery on a PST file
Hi, How do I recover a password on a personal folder file...? Thanks for the help. Marius ...

Hundreds of log files!!!
Hello I've finnally managed to set up my first exchange 2003 server. But now I have a problem: something is generating log text files by the dozen! It appears to be one per message, althought I haven't been able to confirm this. In one night I got 1.5 GB of logs... How do I stop this? Any help appreciated They sound like your transaction log files. The correct way to purge them is to perform a full online backup of Exchange using an Exchange-aware backup program; the backup will then purge the committed log files. Certainly, it is not recommended to manually remove them. -...

PST file on flash memory?
Are there any known pitfalls in having my pst file on a USB memory stick? USB memory sticks have a finite lifespan (measured in reads & writes). With a modern stick, you are probably not going to hit it for a long time. I would however suggest that you have some backup scheme to back the file up to a hard drive regularly, and with increasing frequency the older the stick becomes. I don't know of anyone actually having tried this, so you are in uncharted territory. Do you want to do this so that you are able to transport the PST or in an attempt to increase performance? Patri...

excel closes when trying to open certain files
Excel 2003 will close when trying to open a specific file. When Excel is reopened the file is in the recovery box. When I open the file from the recovery box it gives a message that the file is too corrupt to repair and most of my data is gone along with any formatting. This is the only file that seems to be affected and it use to open without any problems. The same file will open on other computers with Excel 2003 without any problems. The only difference between this file and others that seem to have no problem is before the file opens, it ask to disable or enable macros. This f...

File or directories missing in when attaching a file
Good Day, We are running Outlook 2003 SP2 on a Windows XP Pro SP2 system. We are connected to the network with mapped drives. Out of the blue we have started noticing that some users go to attach a file in Outlook via the insert file button, the file or folder is not showing up in the window. The window is set for all files but a folder or two are missing. For instance we may have the following which are folders 60107 60108 60109 The above folders which are in numerical sequence, if I go into windows explorer I see all the folders but when I go into Outlook and click on the inser...

Which GP feature can generate EFT text file (Payable cheque)
We need to generate text file be sent to bank for cheque printing & sending cheque to customer. I am using GP 10, but i do not find the window that can generate EFT text-formatted output file. and I expect it in (Tools>>Setup>Purchasing>EFT Payables Setup>EFT file> generation). However, my current GP 10 do not have this window for me to prepare data for generate the text file. Please advise. Thank you. EFT for Payables Management. Best regards, -- MG.- Mariano Gomez, MIS, MCP, PMP Maximum Global Business, LLC http://www.maximumglobalbusiness.com The...

How to reversibly close Outlook with some files open?
Windows Update routinely closes Outlook when it has email files open, and then restarts Outlook with these same files open after it re-boots with patched installed. How can a user accomplish the same result, i.e., close Outlook with some email files open and then have these files re-open when Outlook is re-started? Thanks! Use File-> Close to close Outlook instead of the top right X. -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downloads, Add-Ins and more http://www.msoutlook.info/ ...

Choosing a file encoding in VBA
Hello, I have to work with the Mac version of Excel (v.X, equivalent to Excel 2000). In a macro, I want to save a string as a file (with the open path fo output as #1 .... close #1 instructions), but I remarked that the file encoding was Mac OS Roman. Does anyone know how I can save the file with the Windows-1252 or UTF-8 file encoding? Thanks, Renaud -- Renaud do you have a file, save as, file type txt (MS-DOS) *.txt -- --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: ...

PST file is too big for online backup
Hi, My Office Outlook 2007 pst file has grown to hundreds of megabytes in size, and I cannot do an online differential backup. Can Outlook store it as hundreds of 1Mb chunks regardless of folders, or split it into separate files for each sub folder ? thanks, Brian No You wont be doing a differential backup in any case, the pst is a single file, and its attribute is reset whenever outlook is opened, in other words only a full backup will be done. Have you used any of the archive options? "Brian Stoop" <b.stoop@consultant-spam.free.com> wrote in message news:u4QqlpL...

Filing Outlook Notes.
Why can't I put a MS Outlook 2000 SR1 Corporate or Workgroup Note anywhere other than the Notes folder? I would like to be able to drag and drop Notes into other Folders that I create in the same way as I can MS Word, Excel, PowerPoint etc files from Win Explorer. Is this possible? If so how, is there something I need to tweak to enable this, or is it a 'feature' of Outlook? Drag and drop the note anywhere you want but realize that it will take on the default form for the folder where you drop it. For instance, dragging a note to the calendar will create a calendar item. ...

how do I unshare an excel file?
I have a shared file but I want to unshare it. Is there any easy way to do this? Press Alt+T+B>>Editing>>UNCHECK the “Allow changes by more than one User at the same time. This also allows workbook merging” and give Ok. -- Remember to Click Yes, if this post helps! -------------------- (Ms-Exl-Learner) -------------------- "Me" wrote: > I have a shared file but I want to unshare it. > Is there any easy way to do this? EXCEL 2007 Review / Changes group / Share Workbook / Editing tab - remove the tick (check) from the field called:- Al...

Create Symbolic Link and Move Files and Subfolders older than 30 D
Hello Community, I'm looking free up some disk space on our most active volume by moving some directory stuctures older than(Last modified Date) 30 days. I prefer it to make it transparent to the users and hence want create a symbolic link for each file and that's moved so the user is not required to be aware of the new location. Some experts please help me establish the script structure. Thanks in advance ...

Bar Charts created in Excel 2003
For certain charts that I create within Excel 2003 (usually bar charts), I use a font size of 8 (eg for data labels, axis labels, and scale). If I close the file and then re-open it, all these fonts will have become size one (title and legend are not effected). Oddly, if I have created a bar chart and made several copies of it within a worksheet, it will only be the original and not the copies that are affected by this. If anyone can shed any light on why this may be happening and how it could be fixed, I would really appreciate it. I've also posted this in the excel group so apologies to ...

C++ Asignment, submiting files
Hi, I have an assignment to submit and right at the end the instructions are: 1) Source code (must compile cleanly in Visual C++ 6 or 7). I have warning set to 3, the code compiles with no warnings and of course no errors. 2) Compiled Win32 binaries. Include any 3rd party DLLs needed to run the application. How can I find out, for certain, what DLLs are needed? My app does not use any third party DLL, (none that I know). Must I submit the windows stuff as well, I will build statically so there is no need for any Dll as far as I know. But how can I really tell? Thanks Simon "S...

Partition Handling
I didn't get an answer in replication so I am posting this here: We've got some big SS 2000-style partitioned views using traditional horizontal partitioning that we want to migrate to the new SS 2005 partitioning. The underlying tables to the view are partitioned by date in all cases and so each view holds 3-10 years of data with each table generally being quarterly. One nice thing is that when we have a replication issue and replication breaks and needs to be reinitialized, we can specify just the most recent table. In other words, if I have to reinitialize I only r...

Help with shariing excel file !
Hi, I have strange problem since a few weeks with an excel file I share. This file is stored on aW2003 SBS. It can only be modified by one person (it has a "modify" password is set). The file is *always* opened from the same station, by the same user ! I set this thru : "Save as", then "Tools", "General option". Now, sometimes, when this famous user opens the file, it gets an error, which tells him that... the file is already opened by ... him ! Of course, it can't modify it since the file is exclusive ! I tried to reboot the station, nothing ! The ...

Corrupt Data file
I am at a loss and hope that someone can help me. Thanks ahead of time for all the posts and feed back! I can't open my money data file. When I open it it says: Money has detected that yoy did not close the file "Jens Financial Info" before exiting. Money now needs to verify the information in your file. If your file is large, this may take a few minutes. Do you wish to do this now? I then click on yes and the file doesn't open. It give me a box to either open a file, restore a backup, or recover a file. If I try to recover the file using the Super salvage tool eit...

Error. An object could not be found opening attach in a MSG file
I have a customer that can open attachments in outlook without any problem. But if he saves a mail to a folder in .MSG format and tries to open the message later, he can't open the attachment and recieves the error "Error. An object could not be found" (it's in spanish but i think the translation is right -> Error. No se encontr=F3 un objeto) Office 2003, XP SP2. Already tryed and didn't fixed the problem: - create a new profile with a new pst - changed securetemp folder to another location - clear forms cach=E9 from outlook advanced options - uninstalled office, CCLE...

Relative file paths
I have an excel spreadsheet that contains calculations and a Word document that has a number of link references to it within the text of a report. Everything works fine and the excel sheets show up in the report as another page with headers and footers and correct page numbers etc. The problem occurs when I want to copy the two files to another project subdirectory and then try to make chnges to both. All the links in the Word document still refer back to the original excel spreadsheet back in the first project subdirectory. I have to manually repoint all the links to the new project subdir...

Problem in reading .csv file with unicode characters
Hi everybody, I got problem in reading .csv file with unicode characters. The .csv file is generated by a self-developed application and Chinese characters is included in that file. I open it by Excel 2003 and found all Chinese characters are mis-encoding. Of course, if I change the encoding of .csv file to BIG5 (or ASCII), it is ok. However, I need to keep unicode encoding to fit my application requirement. Does anybody know the solution on my case? I suppose Excel 2003 supports unicode. Am I right? Thanks for your attention and kindly advice! Regards, James Wong James I a...

Quttro pro, QPW file
Any ideas how to open a Quttro pro file with the extension .QPW in excell XP? File>Open>select Quattro Pro/DOS from the Files of Type list at the bottom of the dialog box. HTH |:>) "fastfreddy125" wrote: > Any ideas how to open a Quttro pro file with the extension .QPW in excell XP? freddy You need the Quattro Pro convertors from MS. http://office.microsoft.com/en-ca/results.aspx?Scope=DC&Query=quattro+pro Then read this from Jim Rech http://snipurl.com/cz3x Gord Dibben Excel MVP On Tue, 22 Feb 2005 11:19:07 -0800, "fastfreddy125" <fastfreddy...