Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a basic feedback form on my page. This is the surface controller...
using Umbraco.Web.Mvc; using System.Web.Mvc; using InstallUmbraco.Models; using System.Net.Mail; namespace InstallUmbraco.Controllers { /// <summary> /// Surface controller for contact form model /// </summary> public class ContactSurfaceController : SurfaceController { public ActionResult Renderform() { return PartialView("~/Views/Partials/_Contact.cshtml"); } [HttpPost] [ValidateAntiForgeryToken] public ActionResult SubmitForm(ContactModel model) { if(ModelState.IsValid) { SendEmail(model); return PartialView("~/Views/Partials/_Contact_SUCCESS.cshtml"); } return PartialView("~/Views/Partials/_Contact_FAIL.cshtml"); } private void SendEmail(ContactModel model) { string htmlMsg = "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">"; htmlMsg = htmlMsg + "<tr><td>Name:</td><td><strong>" + model.YourName + "</strong></td></tr>"; htmlMsg = htmlMsg + "<tr><td>Email:</td><td><strong>" + model.YourEmail + "</strong></td></tr>"; htmlMsg = htmlMsg + "<tr><td>Message:</td><td><strong>" + model.YourMessage + "</strong></td></tr>"; htmlMsg = htmlMsg + "</table>"; string subject = string.Format("Enquiry from {0} - {1}", model.YourName, model.YourEmail); MailMessage message = new MailMessage("website@mywebsite.com", "sales@mywebsite.com", subject, htmlMsg); message.IsBodyHtml = true; SmtpClient client = new SmtpClient(); client.Send(message); } } }
The Partial view looks like this...
@inherits UmbracoViewPage<InstallUmbraco.Models.ContactModel> <div id="formOuter"> @using (Ajax.BeginForm("SubmitForm", "ContactSurface", null, new AjaxOptions { HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = "formOuter" })) { @Html.AntiForgeryToken() <div class="grid-x" id="js-contact-form"> <div class="cell small-12 redText" id="js-contact-form-errors"> @Html.ValidationSummary() </div> <div class="cell small-12"> <label> Name: @Html.TextBoxFor(m => m.YourName, new { placeholder = "Your Name" }) </label> </div> <div class="cell small-12"> <label> Email: @Html.TextBoxFor(m => m.YourEmail, new { placeholder = "your@email.here", type = "email" }) </label> </div> <div class="cell small-12"> <label> Message: @Html.TextAreaFor(m => m.YourMessage, new { placeholder = "Your message...", rows = "5" }) </label> </div> <div class="cell small-12"> <button class="button use-ajax">Submit</button> </div> </div> } </div>
It seemed to work well, but after reboots, etc. I get the YSOD with the following info...
Unable to resolve type: InstallUmbraco.Controllers.ContactSurfaceController, service name:
Can anyone help or explain why this is happening periodically?
Thanks in advance!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Unable to resolve type: InstallUmbraco.Controllers.ContactSurfaceController, service name:
I have a basic feedback form on my page. This is the surface controller...
The Partial view looks like this...
It seemed to work well, but after reboots, etc. I get the YSOD with the following info...
Unable to resolve type: InstallUmbraco.Controllers.ContactSurfaceController, service name:
Can anyone help or explain why this is happening periodically?
Thanks in advance!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.