1

私は次のコードを持っています:

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場合です。つまり、このフォルダーはハードドライブにもどこにも存在せず、どのように取得されたのかわかりません。戻ってきた。しかし、この問題のためにこれは例外をスローしていると述べました:attachmentsServer.MapPathPostLinkedResource(attachments);

{"Could not find a part of the path ‘G:\\Program Files\\Derby\\Work\\Development\\proj\\proj\\Post\\Content\\Posts\\2013\\8\\file01.txt"’
4

2 に答える 2