Url.Action giver nullreference, bliver kaldt ude af context.
Hej.Jeg har en MailController, som bliver kaldt fra en anden controller, men min Url.Action smider en nullreference.
Eksempel:
Bruger opretter sig, SendWelcomeMail bliver kaldet:
public void SendWelcomeMail(string toMail)
{
StringBuilder sResult = new StringBuilder();
XmlDocument xDoc = new XmlDocument();
xDoc.Load(ConfigurationManager.AppSettings["mapToMail"] + "wCustomer.xml");
string subject = xDoc.GetElementsByTagName("subject")[0].InnerText;
StringBuilder body = new StringBuilder();
body.Append(xDoc.GetElementsByTagName("body")[0].InnerText);
body.Replace("\n", "<br />");
body.Replace("", "<i>");
body.Replace("", "</i>");
body.Replace("[", "<");
body.Replace("]", ">");
body.Replace("%HOWITWORKS%", Url.Action("FAQ","Home"));
SendMail(toMail, subject, body.ToString());
}