私は次のコードを持っています:
var dir = @"Content\Posts\" + yr + @"\" + mnth + @"\";
var a = Path.Combine(dir, dy.ToString() + pId.ToString() + ".txt");
//a contains: "Content\\Posts\\2013\\8\\file01.txt"
stts = obj.NotifyMail(title, writeup, "author@gmail.com", a);
そして、NotifyMail関数よりも私はこれを持っています:
public bool NotifyMail(string subject, string body, string toAdd, string filePath)
{
…
string attachments = HttpContext.Current.Server.MapPath(filePath);
//NOW here attachments contains: "G:\\Program Files\\Derby\\Work\\Development\\proj\\proj\\`Post`\\Content\\Posts\\2013\\8\\file01.txt"
var attchmnts = new LinkedResource(attachments);
attchmnts.ContentId = "attchmnts";
…
}
問題は、無効なフォルダーが含まれているパスを返すことで物理ファイルパスを取得するNotifyMail
場合です。つまり、このフォルダーはハードドライブにもどこにも存在せず、どのように取得されたのかわかりません。戻ってきた。しかし、この問題のためにこれは例外をスローしていると述べました:attachments
Server.MapPath
Post
LinkedResource(attachments);
{"Could not find a part of the path ‘G:\\Program Files\\Derby\\Work\\Development\\proj\\proj\\Post\\Content\\Posts\\2013\\8\\file01.txt"’