// stuff......
return SendCreationMail(Membership.GetUser((Guid)request.UserEntityId), request, new Control());
}
private const string TemplateRoot = "~/app_shared/templates/mail/";
private const string ServerRoot = TemplateRoot + "server/";
public static bool SendCreationMail(MembershipUser user, IServerAccountRequest request, Control owner)
{
var definition = new MailDefinition { BodyFileName = string.Concat(ServerRoot, "creation.htm"), IsBodyHtml = true };
var subject = "New {0} account created!".FormatWith(request.ServerApplicationContract.Id);
var data = ExtendedData(DefaultData, subject, user);
data.Add("<%ServerApplication%>", request.ServerApplicationContract.Id);
data.Add("<%ServerApplicationName%>", request.ServerApplicationContract.ApplicationName);
data.Add("<%AccountUsername%>", request.AccountUsername);
data.Add("<%ServerInfo%>", "/server/{0}/info".FormatWith(request.ServerApplicationContract.Id.ToLower()));
return definition.CreateMailMessage(user.Email, data, owner).Send(subject, ApplicationConfiguration.MailSenderDisplayName);
}
I get:
Value cannot be null. Parameter name: basepath
at System.Web.Util.UrlPath.Combine(String appPath, String basepath, String relative)
at System.Web.UI.WebControls.MailDefinition.CreateMailMessage(String recipients, IDictionary replacements, Control owner)
at Damnation.Website.Main.Common.MailTemplating.Server.SendCreationMail(MembershipUser user, IServerAccountRequest request, Control owner)
at Damnation.Website.Main.Common.MailTemplating.Server.SendCreationMail(IServerAccountRequest request)
at Damnation.Website.Main.Business.Model.ServerAccountRequest.UpdateRequestsAfterServerProcessing(IEnumerable`1 results)
Thing is I don't have an actual Control to pass to it, I'd like to know how to setup a control that avoids this senseless exception. I'm using a relative path... so this makes no sense.
The application that has the service is under ASP.NET WebForms .NET 4. The consumer application is a console application also under .NET 4