Re: Error on creating a text file to write lines

From: Marina (someone_at_nospam.com)
Date: 01/06/05


Date: Thu, 6 Jan 2005 16:05:53 -0500

Sounds like you opened this file at some point, but never closed it. So it
is still locked by the other object you used to access it. Make sure you
always close any stream that accesses your file.

You will probably need to restart asp.net to release the file lock.

"JenHu" <jenniferhu46@hotmail-dot-com.no-spam.invalid> wrote in message
news:41dda5eb$1_1@Usenet.com...
> Hi all,
>
> I want to create a text file to write lines, but it gives me an error
> on Dim sw As New StreamWriter(CreatePath & Efilename) :
> System.IO.IOException: The process cannot access the file
> "C:\temp\DD_01062005.txt" because it is being used by another
> process.
>
> Can someone point me out where did I do wrong? Thanks.
>
> ------------------------------------------------------------------
> Dim CreatePath As String = "C:\temp\"
> Dim Efilename As String = "DD_" & Format(Date.Today,
> "MMddyyyy").ToString & ".txt"
> File.Create(CreatePath & Efilename)
> Dim sw As New StreamWriter(CreatePath & Efilename)
>
> *-----------------------*
> Posted at:
> www.GroupSrv.com
> *-----------------------*



Relevant Pages

  • Re: [PATCH 10/30] cr: core stuff
    ... You can do many nice things when the checkpoint can be streamed: ... transform the stream from one c/r version to another etc. ... kernel doesn't know in which order to dump A and B. ... if tidy-bits issues to solve during restart regardless. ...
    (Linux-Kernel)
  • Re: WMS does not restart automatically
    ... > Windows media serves does not automatically restart when the source stream ... > fails and restarts the Media services does not restart the broadcast. ... > monitor tab states that the publishing point is started, but the stream has ... > restart the publishing point. ...
    (microsoft.public.windowsmedia.server)
  • Re: how to calculate cnsSampleTime
    ... cases when the stream breaks and the reader is restarted. ... I didn't plan to use the system time as is, ... the system time that elapsed from the break to the restart. ...
    (microsoft.public.windowsmedia.sdk)
  • Re: Media Services - Automatic Restart of PublishigPoint?
    ... In this way the publishing point never stops. ... I am streaming a live stream from a remote distribution server. ... possibility to automatically restart a publishing point after the publishing ...
    (microsoft.public.windowsmedia)
  • Re: Mapped Drives problems
    ... I had already decided it would be easier to be able to restart the ... system in case of a file lock, then to put a halt to accounting work 10 ... | need to think about that stuff before you go fooling with the time-out ...
    (microsoft.public.windows.group_policy)