Hello Friends,
I am new on this group.
I have a problem in my functionality.
i am using asp.net using vb.net.
The pocess is as a way that I have to send a mail with attachment.I am using Input file type tag control to get Attachment file from directory.After it i am saving attachment file on server folder.After it i am sending file path to attachment function as string.After it attachment is working fine.
But after it i want to delete that file from server and when i wrote code for delete fileas following:
File.delete(Path of file)
but when runtime start execute this code ther is error as fllowing:
"The process can not access the file <Path of file> because it is being used by another process.mscorlib"
Please help me.
Arminder Singh
![]() |
0 |
![]() |
Make sure in your code you close the access to the file before you try to delete it.
Welcome to my SQL/ASPNET forum for Chinese
http://51up.org/bbs/forumdisplay.php?fid=38
![]() |
0 |
![]() |
Thanks lori for your help .
I know i need to close the access but i don't know how to close that access.
In first access of file i am using function to send mail and i am giving only path to the functin as a string parameter.Like following
Mailing.RelayMail(strSenderName, strSenderAddress, strRecipientName, strRecipientAddress, strSubject, txtBody, attachment)
attachment=Physical path of file.
After it i am deleting file by using following code.
File.Delete(Physical Path of file as a parameter)
and i dn't know how to close tha access after send attachment .
waiting for ur reply........
Arminder
![]() |
1 |
![]() |
O lori ....Thanks for ur comments....
I have resolved the problem with the help of ur comments.....
I ispose all the objects which i was using or process and prblem is resolved.
Again Thanks to u for help for ur so valuable comment....
Arminder
![]() |
0 |
![]() |
HiArminder , it's great that you've self-resolved the issue
Welcome to my SQL/ASPNET forum for Chinese
http://51up.org/bbs/forumdisplay.php?fid=38
![]() |
0 |
![]() |