K
Kees
Hi there,
Im having a bit of trouble with a logfile I use to put logevents in with a
streamwriter, after I have written in this file I want to send the file as a
mailattachment with smtp.
This all works fine until the smtp server goes off line or something goes
wrong.
I'm then catching the 'Mail.Send' exception.
Now there is the problem. The log file I tried to send is now locked so when
the
streamwriter wants to write a line in the file, streamwriter throws me an
exception.
'file is in use by an other process'
the file is now locked and will only unlock when the mail is send (without
exception) or when i kill the app.
Why is it locked, or better, how do I get it unlocked?
Anyone?
//////////////////////////////////////////////////////////////
Try
SmtpMail.SmtpServer = SmtpServer
SmtpMail.Send(MyMail)
Catch ex As Exception
' Now the file is
locked
Return ex.Message
End Try
//////////////////////////////////////////////////////////////
Im having a bit of trouble with a logfile I use to put logevents in with a
streamwriter, after I have written in this file I want to send the file as a
mailattachment with smtp.
This all works fine until the smtp server goes off line or something goes
wrong.
I'm then catching the 'Mail.Send' exception.
Now there is the problem. The log file I tried to send is now locked so when
the
streamwriter wants to write a line in the file, streamwriter throws me an
exception.
'file is in use by an other process'
the file is now locked and will only unlock when the mail is send (without
exception) or when i kill the app.
Why is it locked, or better, how do I get it unlocked?
Anyone?
//////////////////////////////////////////////////////////////
Try
SmtpMail.SmtpServer = SmtpServer
SmtpMail.Send(MyMail)
Catch ex As Exception
' Now the file is
locked
Return ex.Message
End Try
//////////////////////////////////////////////////////////////