Copied to clipboard

Flag this post as spam?

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


  • vijayadurga 17 posts 37 karma points
    Apr 26, 2013 @ 12:05
    vijayadurga
    0

    MVC 4 with Umbraco 6

    hi

    I have created the solution in visual studio 2010,

    but my problem is am unable to add Controller in controller , its giving some version error Please find the Screen shot

     

     

     

    Please can anybody help on this

    Thanks

    Vijayadurga P

     

  • Michael Westgate 11 posts 31 karma points
    Apr 26, 2013 @ 13:00
    Michael Westgate
    0

    Can you provide more details? Such as an error message or screen shot?

    I would recommend checking out this excellent guide from Ben Morris... http://www.ben-morris.com/using-umbraco-6-to-create-an-asp-net-mvc-4-web-applicatio to hopefully spot anything you may or may not have done.

     

    From the link...

    Creating a custom controller

    The default rendering engine for Umbraco routes requests through RenderMvcController with an IPublishedContent object as the model view. This provides a pretty simple means of  basic pages rigged up with managed content but you can extend this behavior by creating custom controllers. Umbraco refers to this technique of creating custom controllers as hijacking, though really it is just a matter of creating a controller where MVC would normally look.

    To create a controller for our Home view we just create a controller called HomeController. To hook it up to Umbraco’s content API you will need to inherit from RenderMvcController and override the Index method as shown below:

    public class HomeController : Umbraco.Web.Mvc.RenderMvcController
    {
        public override ActionResult Index(RenderModel model)
        {
            //Do some stuff here, then return the base method
            return base.Index(model);
        }
    }

    Creating controllers to handle forms and actions is a little more involved as you have to create what Umbraco calls asurface controller. This is a controller like any other but one that is derived from the Umbraco SurfaceControllerclass. These controllers can be implemented as a normal part of your MVC project (“locally declared” in Umbraco-speak) or implemented as a plug-in for shipping as part of a package.

    If you want to include your own custom MVC routes then you will have to override the OnApplicationStartedmethod. This can be done by creating your own custom global.asax file that inherits from Umbraco.Web.UmbracoApplication.

  • Charles Afford 1163 posts 1709 karma points
    Apr 26, 2013 @ 13:20
    Charles Afford
    0

    You also need to change the umbraco config (correct me if i am wrong there) from WebForms to MVC :)

  • vijayadurga 17 posts 37 karma points
    Apr 26, 2013 @ 14:37
    vijayadurga
    0

    Thanks for the reply

    i changed it in config..

     

  • Charles Afford 1163 posts 1709 karma points
    Apr 26, 2013 @ 14:50
    Charles Afford
    0

    Did that work?  and no problem :)

  • vijayadurga 17 posts 37 karma points
    Apr 26, 2013 @ 14:58
    vijayadurga
    0

    no its not working ,, actually we have folllowed your steps .  i mean what u mentioned in your blog ...

    based on that we created solution and copied files from Zip except App_code, bin folders, and changed the UmbracoSetting.config

    Db Set up for Umbraoco  :-) ....

  • Charles Afford 1163 posts 1709 karma points
    Apr 26, 2013 @ 16:49
    Charles Afford
    0

    My blog post does work :).  So what error are you getting now?  Charlie :)

  • vijayadurga 17 posts 37 karma points
    Apr 27, 2013 @ 08:48
    vijayadurga
    0

    hi

    i have tried with u r examples but am getting this error . i dont what i was doing mistake here .. its ot working at all :-(     please  help me on this

    since one week i am fighting with this :-(

     

  • Marthijn Wassink 17 posts 50 karma points
    Apr 27, 2013 @ 13:24
    Marthijn Wassink
    0

    Hi Vijayadurga ,

    We can only help you if you post more details. So again what is the error you getting?

  • Brendan Rice 538 posts 1100 karma points
    Apr 29, 2013 @ 01:15
    Brendan Rice
    0

    I think this error happens as there is a conflict in the version of MVC that uGoLive uses and the version of MVC used in 2010.

    Try this:

    1. Take a copy of the uGoLive dll in the bin folder
    2. Delete the uGoLive dll

    I couldn't see the screenshot so I am only assuming that it is the same error.

    Hope this helps.

  • vijayadurga 17 posts 37 karma points
    Apr 29, 2013 @ 06:58
    vijayadurga
    0

    Thanks.. I have checked in my bin but there are 3 dlls are there

    1.Our.Umbraco.uGoLive.47x.dll

    2.Our.Umbraco.uGoLive.Checks.dll

    3.Our.Umbraco.uGoLive.dll

    these three dlls i need to delete ?

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Apr 29, 2013 @ 09:23
    David Brendel
    0

    If it's only VS that tells you it's unable to create a controller than you just have to create a class in the controllers folder.

    You can than derive it from the Umbraco controllers.

    I have the same error when i try to create a controller in VS, but with just creating a class it works.

  • vijayadurga 17 posts 37 karma points
    Apr 29, 2013 @ 10:17
    vijayadurga
    0

    yes exactly .. but now we i overcome that problem..:-)

  • Brendan Rice 538 posts 1100 karma points
    Apr 29, 2013 @ 18:46
    Brendan Rice
    0

    Did you get the issue fixed? What worked for you in the end?

  • vijayadurga 17 posts 37 karma points
    Apr 30, 2013 @ 09:03
    vijayadurga
    0

    yes.. :-).. i am adding the controllers like(see the screen shots) in this way..

     

     

    in added controller we are inherting Surfacecontroller(see the screen shot)

  • vijayadurga 17 posts 37 karma points
    Apr 30, 2013 @ 09:05
    vijayadurga
    0

    r u able to see the screen shots ?

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Apr 30, 2013 @ 09:33
    David Brendel
    0

    Sadly i can't see any Screenshot. Would also like to know how you did it.

Please Sign in or register to post replies

Write your reply to:

Draft