Umbraco issue
Opened this issue ยท 3 comments
Hey,
I'm using with umbraco but I have following issue:
Server Error in '/' Application.
Value cannot be null.
Parameter name: routeData
Here is my controller
private IUserMailer _userMailer = new UserMailer();
_userMailer.Welcome(registerFormModel).Send();
And my Welcome method
public virtual MvcMailMessage Welcome(RegisterModel model)
{
return Populate(x =>
{
x.Subject = "Welcome";
x.ViewName = "Welcome";
x.To.Add(model.Email);
});
}
My web config:
<smtp deliveryMethod="Network">
<network host="test.server.com" />
</smtp>
Hi. Yep, I had the same issue when I was trying to use MVCMailer with Umbraco. So if it has a workaround, that would be great to see so I can go back to using MVCMailer.
The responses in this issue led me to my solution:
var data = new RouteData();
data.DataTokens["playermailer"] = "PlayerMailer";
this.ControllerContext = new ControllerContext(context, data, this);
context
in this case is the HttpContext which is passed into the constructor. PlayerMailer
is the directory containing the views.
Glad I posted this for my future self as I just hit the problem again on an old site and uncovered this while looking for a solution! ๐
The responses in this issue led me to my solution:
var data = new RouteData(); data.DataTokens["playermailer"] = "PlayerMailer"; this.ControllerContext = new ControllerContext(context, data, this);
context
in this case is the HttpContext which is passed into the constructor.PlayerMailer
is the directory containing the views.
Glad I posted this for my future self as I just stumbled across it again while looking for the solution in an old site ๐