19GreenBlankets 19GreenBlankets - 5 months ago 32
C# Question

How to make 2 process access the same path?

I'm using c#. I'm receiving an error about a path is currently accessed by other processes. What my system is trying to do is to access the path: @"C:\temps\" + client_ids + "_" + rown + ".pdf" and use the same path for attachment before sending it to client's email.

here's what I've done so far. I comment out some of my code because I'm not sure what to do.

FileStream fs = null;
using (fs = new FileStream(@"C:\\temps\\" + client_ids + "_" +
rown + ".pdf",
TextReader tr = new StreamReader(fs);
//Attachment files = new Attachment(tr);

Ali Ali
Answer Source

you can make temp copy of file before you use it in mail attachment and then use the copy instead of the original file

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download