System.UriFormatException on MessageConfig.FileBaseDirectory with relative path.
rtieland opened this issue · 7 comments
When a relative path is used for the property FileBaseDirectory an exception System.UriFormatException: 'Invalid URI: The format of the URI could not be determined.' is thrown.
For example:
FileBaseDirectory = ".\Templates\Attachments"; //Throws exception
FileBaseDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Templates\Attachments"); //Doesn't thow exception.
This is by design:
- The
FileBaseDirectory
must be an absolute path. The default currently isPath.GetTempPath()
. - The file paths (e.g. attachments) are relative to the
FileBaseDirectory
.
I updated the xmldoc of the property accordingly.
Does this make sense to you?
Do you have a proposal to improve or should we close the issue?
Commit 88ea355 addresses your proposal: MessageConfig.FileBaseDir
will now be checked for an absolute path. This is the earliest checkpoint. Issue resolved?
It turned out in v5.6.0, that checking MessageConfig.FileBaseDir
for a full path already when setting the property causes problems in a web environment, where the final full path is set after the MessageConfig
is read from a configuration file.
In v5.6.1 the full path for MessageConfig.FileBaseDir
will be checked while the MailMergeMessage
's Send...
or GetMimeMessage()
methods are called.