FileInfo NameSpace and methods

D

Do

Hi,

I'm getting the following error messages "The process cannot access the
file "c:\inetpub\wwwroot\nspi1.5\files\DSCF0009.jpg" because it is being
used by another process."

This happens when I call the following code. Am I forgetting the clean up
something?

If objFile.Exists(Current.Server.MapPath("../files/" & filename)) Then

'Delete the physical file

objFile.Delete(Current.Server.MapPath("../files/" & filename))

Return True

Else

Current.Session.Contents("error") = "Physical file does not exist."

Return False

End If
 
S

srinivas moorthy

hi,
Generally, this problem arises if your IIS holds the File
handle resource due to some malicious code i mean not
closing the filestream or file system object. Some times,
even due to some other problem the code behaves
indifferently. Hence better use some Try catch Exceptions,
so, that we can clean the code properly. The basic step
which we need to do for this is to Restart the IIS.

This happens many times to me. My idea to this is better
go for the proper exception handling.

thanks
srinivas moorthy
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top