Cannot find the Umbraco route definition in the route values
Hey guys,
I just finished a site with Umazel Starter Kit but I cannot get the contact form to work. I've been getting "Internal server error 500" which led me to debug and realized I was getting the following error in the code:
This is the entire controller code:
public ActionResult Index()
{
return PartialView("ContactView", new ContactViewModel());
}
[HttpPost]
[NotChildAction]
public ActionResult Submit(ContactViewModel form)
{
if (!ModelState.IsValid)
{
return Json(new { Success = false });
}
SectionContact currSection = (SectionContact)Umbraco.TypedContent(form.CurrentSectionId);
string mailTo = currSection.AdministratorsEmail;
string mailFrom = currSection.NotificationMailFrom;
string mailFromAlias = currSection.NotificationMailSenderAlias;
string message = string.Concat(currSection.NotificationEmailBody, "<br/><br/>", umbraco.library.StripHtml(form.Message));
//Use predefined subject. If predefined subject is not defined, use current subject from form (if any)
string subject = (string.IsNullOrEmpty(currSection.NotificationEmailSubject)) ? form.Subject : currSection.NotificationEmailSubject;
//If all else fails, use standard subject from dictionary.
subject = (string.IsNullOrEmpty(subject)) ? Umbraco.GetDictionaryValue("ContactForm.Subject") : subject;
StringBuilder sb = new StringBuilder(string.Empty);
if (!string.IsNullOrEmpty(form.Name))
{
sb.Append("Name:");
sb.Append("<br/>");
sb.Append(form.Name);
sb.Append("<br/><br/>");
}
if (!string.IsNullOrEmpty(form.Subject))
{
sb.Append("Subject:");
sb.Append("<br/>");
sb.Append(form.Subject);
sb.Append("<br/><br/>");
}
sb.Append("Email: ");
sb.Append("<br/>");
sb.Append(form.Email);
sb.Append("<br/><br/>");
sb.Append("Message: ");
sb.Append("<br/>");
sb.Append(umbraco.library.ReplaceLineBreaks(message));
sb.Append("<br/><br/>");
if (!string.IsNullOrEmpty(currSection.Dropdown1Values))
{
sb.Append(currSection.Dropdown1Values.Split(new string[] { "\n", "\n\r" }, StringSplitOptions.RemoveEmptyEntries)[0]);
sb.Append("<br/>");
sb.Append(form.DropDown1);
sb.Append("<br/><br/>");
}
if (!string.IsNullOrEmpty(currSection.Dropdown2Values))
{
sb.Append(currSection.Dropdown2Values.Split(new string[] { "\n", "\n\r" }, StringSplitOptions.RemoveEmptyEntries)[0]);
sb.Append("<br/>");
sb.Append(form.DropDown2);
sb.Append("<br/><br/>");
}
if (ModelState.IsValid)
{
Utils.SendEmail(mailFrom, mailFromAlias, mailTo, subject, sb.ToString());
}
return Json(new { Success = true });
}
}
Cannot find the Umbraco route definition in the route values
Hey guys,
I just finished a site with Umazel Starter Kit but I cannot get the contact form to work. I've been getting "Internal server error 500" which led me to debug and realized I was getting the following error in the code:
This is the entire controller code:
And this is the view:
is working on a reply...