HighTechTalks DotNet Forums  

How to free a file from IIS ?

ASP.net Caching microsoft.public.dotnet.framework.aspnet.caching


Discuss How to free a file from IIS ? in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
ByB
 
Posts: n/a

Default How to free a file from IIS ? - 02-04-2005 , 04:58 AM






Hello,

I am developping an app with ASP .NET, and C# and I have a problem :

My app creates a temporary file, and when I need to erase this file, I
get an error message about this file beeing used by another process, so
i am unable to erase it.

Is there a solution for me to free this file from IIS and then erase it
properly ?

Thank you for your help.

--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net


Reply With Quote
  #2  
Old   
Scott M.
 
Posts: n/a

Default Re: How to free a file from IIS ? - 02-04-2005 , 08:54 AM






Stop the aspnet_wp.exe process and then try it. Also, make sure that in
your app, you are closing the file properly, so it does not become locked.


"ByB" <email (AT) email (DOT) com> wrote

Quote:
Hello,

I am developping an app with ASP .NET, and C# and I have a problem :

My app creates a temporary file, and when I need to erase this file, I get
an error message about this file beeing used by another process, so i am
unable to erase it.

Is there a solution for me to free this file from IIS and then erase it
properly ?

Thank you for your help.

--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net




Reply With Quote
  #3  
Old   
ByB
 
Posts: n/a

Default Re: How to free a file from IIS ? - 02-04-2005 , 09:14 AM



Thank you, but my concern is about deleting this file from my app, when
I do not need it anymore, so I cannot stop aspnet_wp.exe process each
time I have to delete a file
(BTW, this file is just a JPG temporary file created by my app, not a
system or DLL file created by ASP or IIS)



Scott M. a utilisé son clavier pour écrire :
Quote:
Stop the aspnet_wp.exe process and then try it. Also, make sure that in your
app, you are closing the file properly, so it does not become locked.


"ByB" <email (AT) email (DOT) com> wrote in message
news:mn.22927d52a59994d4.26808 (AT) email (DOT) com...
Hello,

I am developping an app with ASP .NET, and C# and I have a problem :

My app creates a temporary file, and when I need to erase this file, I get
an error message about this file beeing used by another process, so i am
unable to erase it.

Is there a solution for me to free this file from IIS and then erase it
properly ?

Thank you for your help.

-- Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net

--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net



Reply With Quote
  #4  
Old   
Alvin Bruney [MVP]
 
Posts: n/a

Default Re: How to free a file from IIS ? - 02-04-2005 , 10:24 AM



One approach is to use the static GetTempFile property of the path object.
It returns a temporary path which may be used to write temporary files.
Temporary files are cleaned up on application restarts or server reboots so
if your delete code fails, the file eventually gets cleaned up. This
approach is also thread safe and scalable.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://tinyurl.com/27cok
----------------------------------------------------------


"ByB" <email (AT) email (DOT) com> wrote

Quote:
Thank you, but my concern is about deleting this file from my app, when I
do not need it anymore, so I cannot stop aspnet_wp.exe process each time I
have to delete a file
(BTW, this file is just a JPG temporary file created by my app, not a
system or DLL file created by ASP or IIS)



Scott M. a utilisé son clavier pour écrire :
Stop the aspnet_wp.exe process and then try it. Also, make sure that in
your app, you are closing the file properly, so it does not become
locked.


"ByB" <email (AT) email (DOT) com> wrote in message
news:mn.22927d52a59994d4.26808 (AT) email (DOT) com...
Hello,

I am developping an app with ASP .NET, and C# and I have a problem :

My app creates a temporary file, and when I need to erase this file, I
get an error message about this file beeing used by another process, so
i am unable to erase it.

Is there a solution for me to free this file from IIS and then erase it
properly ?

Thank you for your help.

-- Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net


--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net




Reply With Quote
  #5  
Old   
Ollie Riches
 
Posts: n/a

Default Re: How to free a file from IIS ? - 02-08-2005 , 06:22 AM



Surely if the file handle has been released then you should be able to
delete the file programmatically?

Are calling the Close\Dispose on the correct objects if you are manipulating
the file using the System.IO namespace, ideally you should be using the
'using' keyword.

HTH

Ollie Riches

"ByB" <email (AT) email (DOT) com> wrote

Quote:
Thank you, but my concern is about deleting this file from my app, when
I do not need it anymore, so I cannot stop aspnet_wp.exe process each
time I have to delete a file
(BTW, this file is just a JPG temporary file created by my app, not a
system or DLL file created by ASP or IIS)



Scott M. a utilisé son clavier pour écrire :
Stop the aspnet_wp.exe process and then try it. Also, make sure that in
your
app, you are closing the file properly, so it does not become locked.


"ByB" <email (AT) email (DOT) com> wrote in message
news:mn.22927d52a59994d4.26808 (AT) email (DOT) com...
Hello,

I am developping an app with ASP .NET, and C# and I have a problem :

My app creates a temporary file, and when I need to erase this file, I
get
an error message about this file beeing used by another process, so i
am
unable to erase it.

Is there a solution for me to free this file from IIS and then erase it
properly ?

Thank you for your help.

-- Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net


--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.