I have a basic vb.net form that collects some data, allows users to add attachments, and when they click submit, generates an email that includes the data and the attachments that were uploaded to the server.
To keep my server clean, after the email is sent, I want to remove the attachments... However, I keep getting an error that says it can't access the file because it is being used by another process. I can either send the email or delete the file, but can't get the two to work together... Any suggestions?
my code behind...
Protected Sub dealWithOrderDetails()
Dim mm As New MailMessage()
mm.To.Add(Session("UserEmail"))
mm.From = New MailAddress(Session("UserEmail"))
For i As Integer = 0 To gvMiscFiles.Rows.Count - 1
Dim lb As Label = TryCast(gvMisc ...
Go to the complete details ...