We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Pdf-accessing problem


I am facing the problem of Pdf-accessing actually i m sending PDF file with attachment after saving this file to that server using below code:
System.Net.Mail.Attachment a = new System.Net.Mail.Attachment(Server.MapPath("PDFChangeGrid.pdf"));

and i m saving file using this code below:
it is working fine
this all functioning is happenning on the button click event
as i sent mail first time on button click then mail has sent fine but If again i sent it then problem occurs
"The Process of accessing the file is denied becoz this file is using by another process "

I have tried out to delete that file after sent that pdf and also destroy that attachment variable but this problem occurs on that position because to delete that file first we have to access it so problem consist that time as well.

please tell me right solution for that


Hello Nidhi,

Thanks for considering Aspose.

In order to access the PDF document to be sent again or to delete it, first Attachment object must release the resource PDF document. In order to release the resource file, please use the following method.


In case it does not resolve your problem or you've any further query, please feel free to contact.