Our application server has a folder used to store attachments downloaded by the client. This folder is called the attachments that are located outside the website, not the virtual directory for this folder. I wonder how to link the files of this folder. My code is:
string vetting = "c:\\Attachments";
if (Directory.Exists(vetting +"\\"+ "UserName"))
{
DirectoryInfo di = new DirectoryInfo(vetting+"\\" + "UserName");
FileInfo[] rgFiles = di.GetFiles("*.*");
if (rgFiles.Length > 0)//thumb.db will be a file
{//list is a div on front end.
list.InnerHtml += <span class='SubTitle'>Your attachments list:</span>";
foreach (FileInfo fi in rgFiles)
{
list.InnerHtml += "<br><a href='c:/Attachments/UserName/"+fi.Name+"'>"+fi.Name+"</a>" ;
}
}
else
{
list.InnerHtml += "You don't have any attachment yet.";
}
}
But this will not work, you always need to find the client side c: / Attachments. How can I refer to the server c: / Attachments? Thank you in advance.
source
share