views:

22

answers:

2

I am dispatching emails at clients, notifying them for specific content deliveries and I have a problem with the containing ftp uri in mail body. I am constructing the ftp uri alongside with ftp credentials in the following format, but the credentials part is stripped away (the section user:pass@):

ftp://user:pass@server/relativepath/filename

The code is something like that:

mailTemplate += String.Format("<a href=\"{0}\">File FTP URI: {1}</a><br>",
    new Uri(ftpBaseLink, filename), filename);

and the email is dispatched with the following matter:

MailMessage message = new MailMessage(
    mailSettings.Smtp.From,
    mailTo,
    subject,
    mailMessage) { IsBodyHtml = true };
SmtpClient client = new SmtpClient();               
client.Send(message);

Is there any clue how can I override this "normalization"?

+1  A: 

I think that there was a general "tightening" of security a while back because of the way URLs containing user:pass were being mis-used to fool people into thinking they were clicking on a link to http://www.mybank.com when the link itself was http://www.mybank.com:[email protected]/fake_bank_site. Users are wiser now, but it may be that its this "lockdown" that is affecting you.

My suggestion would be to concatenate the URI yourself, without using Uri

Rob
In debugging mode the mailTemplate variable, has the well-formed ftp uri (with credentials).
Aggelos Mpimpoudis
A: 

off the top, i'd look into what 'new Uri(ftpBaseLink, filename)' becomes as a string.

Gabriel