Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • megatoolz.2018 2 posts 72 karma points
    Aug 15, 2018 @ 11:47
    megatoolz.2018
    0

    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:

    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; }
        }
    }
    

    partial View

    @model UmbracoClean.Models.ContactFormViewModel
    @if (TempData["success"] == null)
    {
    
        <!-- Start Conatct- Area -->
        <section class="contact-area mt-4">
            <div class="container">
                <div class="row justify-content-center text-center">
                    <div class="single-contact col-lg-6 col-md-8 p-4">
                        <h1 class="text-white">«Первые три года ребёнок обучается лучше всего.</h1>
                        <h1 class="text-white">
                            Поэтому не ждите!»
                        </h1>
                    </div>
                </div>
                @using (Html.BeginUmbracoForm<UmbracoClean.Controllers.ContactFormSurfaceController>("SendForm"))
                {
    
                    <div class="row justify-content-center">
                        <div class="col-lg-5">
                            @Html.EditorFor(model=>model.Fname , new { htmlAttributes = new { @class = "common-input"} })
                            @*<input type="text" name="Fname" class="common-input mt-1" placeholder="Введите ваше имя" />*@
    
    
                        </div>
                        <div class="col-lg-5">
                            <input type="text" name="Mname" class="common-input mt-1" placeholder="Введите вашу Фамилию" />
    
    
                        </div>
    
    
                        <div class="col-lg-5">
                            <input type="email" name="Email" class="common-input mt-1" placeholder="Введите вашу почту" />
    
                        </div>
                        <div class="col-lg-10">
                            <input type="text" name="Message" class="common-textarea mt-1 mt-4 mb-1" placeholder="Введите ваше сообщение" />
    
                        </div>
                        <div class="col-lg-10 d-flex justify-content-end">
                            <input type="submit" value="отправить" class="btn btn-primary m-1" />
    
                        </div>
                        <div class="alert-msg"></div>
                    </div>
                }
            </div>
        </section>
        <!-- End Conatct- Area -->
    }
    else
    {
        <p>Отправка успешна</p>
    }
    
  • megatoolz.2018 2 posts 72 karma points
    Aug 16, 2018 @ 11:27
    megatoolz.2018
    0

    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

  • 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.

Please Sign in or register to post replies