Hello, I wrote a controller and a model for the form, when I run the project in the Visual Studio everything works, but after compiling and uploading to the hosting there was an error:"
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'UmbracoClean' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 34:
Line 35:
Line 36: public class _Page_Views_Partials_forms_ContactForm_cshtml : System.Web.Mvc.WebViewPage<UmbracoClean.Models.ContactFormViewModel> {
Line 37:
Line 38: #line hidden
Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\2d8eabfe\b87e4fe8\AppWebcontactform.cshtml.b66a646f.zzqdzlbn.0.cs Line: 36
".
thanks in advance for any help
here is my sources
Controller
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using Umbraco.Web.Mvc;
using UmbracoClean.Models;
namespace UmbracoClean.Controllers
{
public class ContactFormSurfaceController : SurfaceController
{
// GET: ContactFormSurface
public ActionResult RenderForm()
{
return PartialView("forms/ContactForm", new ContactFormViewModel());
}
[HttpPost]
public async Task<ActionResult> SendForm(ContactFormViewModel contactForm)
{
EmailService emailService = new EmailService();
await emailService.SendEmailAsync(contactForm.Email, contactForm.Fname, contactForm.Message,contactForm.Mname,contactForm.Lname);
TempData["success"] = true;
return RedirectToCurrentUmbracoPage();
}
}
}
model
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace UmbracoClean.Models
{
public class ContactFormViewModel
{
[Display(Name ="sadasdasdas")]
public string Fname { get; set; }
public string Mname { get; set; }
public string Lname { get; set; }
public string Email { get; set; }
public string Message { get; set; }
}
}
after a long search and reading the documentation, I think I found a solution to the problem :))) in my code there is a definition of name space, after the removal of which everything worked, and I moved the files from the folder "Models" to the folder "app_data/models", I also deleted "UmbracoClean.Models."from the view
Compilation Error on Hosting after deploy
Hello, I wrote a controller and a model for the form, when I run the project in the Visual Studio everything works, but after compiling and uploading to the hosting there was an error:" Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0246: The type or namespace name 'UmbracoClean' could not be found (are you missing a using directive or an assembly reference?) Source Error:
Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\2d8eabfe\b87e4fe8\AppWebcontactform.cshtml.b66a646f.zzqdzlbn.0.cs Line: 36 ".
thanks in advance for any help
here is my sources Controller
model
partial View
after a long search and reading the documentation, I think I found a solution to the problem :))) in my code there is a definition of name space, after the removal of which everything worked, and I moved the files from the folder "Models" to the folder "app_data/models", I also deleted "UmbracoClean.Models."from the view
is working on a reply...