Re: Process used by another




"Josema" <Jestrade@xxxxxxx> wrote in message
news:C8AB57B7-74AD-4ED0-8364-3419DC27E1F2@xxxxxxxxxxxxxxxx
> Hi,
>
> i have a Web application and i get this error:
>
> The process cannot access the file
> "c:\inetpub\wwwroot\dotnet\Soluciones\Calculations\PhoneTariffs\Errors\Log.txt"
> because it is being used by another
>
> The code that generates this error is the following:
>
> Directory.CreateDirectory("c:\inetpub\wwwroot\Error");
> File.Create("c:\inetpub\wwwroot\Error\log.txt");
>
> System.IO.StreamWriter StreamLog=new
> System.IO.StreamWriter("c:\inetpub\wwwroot\Error\log.txt");
> StreamLog.Write(e.Message);
> StreamLog.Close();
>
> How could avoid that error?.
> --
> Thanks a lot
> Kind Regards.
> Josema

You open the same file two times here.
There is no need for - File.Create("c:\inetpub\wwwroot\Error\log.txt");

Willy.



.



Relevant Pages

  • Process used by another
    ... How could avoid that error?. ... Kind Regards. ... Josema ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: DataTable
    ... Kind Regards. ... "Josema" wrote: ... > Why im getting this error?, i know that im modifing the collection, but this ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Samsung D600/D600e
    ... > Be safe, avoid orange's shit customisation of the software on the phone, ... Prev by Date: ...
    (uk.telecom.mobile)
  • Transfer files on and from CE device
    ... Met vriendelijke groet, With kind regards, ... Frank Beerens ... Prev by Date: ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: How do you feel about Microsofts IMF? nt
    ... ExchangeInbox.com the new MS Exchange Resource site at ... > Kind Regards, ... > MDH ... Prev by Date: ...
    (microsoft.public.exchange2000.general)