Copied to clipboard

Flag this post as spam?

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


  • Nelson 94 posts 246 karma points
    Jan 29, 2016 @ 08:08
    Nelson
    0

    Create a Contact Form

    Hi guys,

    I'm new with Umbraco and I'm now trying to develop a contact form for my website. Through the research I did so far I know I have to work with the surface controllers. I'm using Webmatrix and the Umbraco backoffice to develop my website, is it mandatory to use VS to work with surface controllers? All the tutorials and information I've found so far used only VS, so if I need to use VS how to do the migration of the code?

    Thanks!

  • Nik 1608 posts 7234 karma points MVP 7x c-trib
    Jan 29, 2016 @ 08:35
    Nik
    0

    Hi Nelson,

    Personally I find it much easier to create a website in VS over Webmatrix, mainly because of all the helper methods and debugging tools available.

    Saying that, you can create a surface controller in WebMatrix, I've just done it.

    Simply create a folder for your controllers, then create a CS file. Webmatrix will ask you to put it in app_code but I don't believe you have to actually do that.

    Then paste the following code:

    using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Web.Mvc;
    using Umbraco.Web.Mvc;
    
    /// <summary>
    /// Summary description for MySurfaceControler
    /// </summary>
    public class MySurfaceController : SurfaceController
    {
        public ActionResult Index() 
        {
            return Content("hello world");
        }
    }
    

    There you have it, the basics of a surface controller in WebMatrix.

Please Sign in or register to post replies

Write your reply to:

Draft