Copied to clipboard

Flag this post as spam?

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


  • dub.survivor 58 posts 38 karma points
    Jul 02, 2009 @ 03:01
    dub.survivor
    0

    Use Umbraco with asp.net MVC?

    I am trying to add some functionality to my existing Umbraco website and I thought it would be an ideal opportunity to try out some asp.net MVC but I can't get it to work. Has anybody managed to achieve this. I needed to add a Global.asax file so that I can set up the routing stuff, but I get an error:

  • dub.survivor 58 posts 38 karma points
    Jul 02, 2009 @ 03:10
    dub.survivor
    0

    Oops, that didn't work very well, I'll try again.

    I am trying to add some functionality to my existing Umbraco website and I thought it would be an ideal opportunity to try out some asp.net MVC but I can't get it to work. Has anybody managed to achieve this. I needed to add a Global.asax file so that I can set up the routing stuff, but I get an error:CS0433</span><span class="pun">:</span><span class="pln">
    </span><span class="typ">The</span><span class="pln"> type </span><span class="str">'ASP.globalasax'</span><span class="pln"> exists </span><span class="kwd">in</span><span class="pln"> both
    </span><span class="str">'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
    Files\root\7febd56f\ea879ccf\App
    global.asax.luzrojyp.dll'</span><span class="pln"> </span><span class="kwd">and</span><span class="pln">
    </span><span class="str">'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
    Files\root\7febd56f\ea879ccf\assembly\dl3\49ca83df\a0bf1b5dfae3c901\Appglobal.asax.DLL'
    </span>

     I found a post about this error on the old forum http://forum.umbraco.org/yaf_postst8122_Error-regraging--ASPglobalasax-file.aspxwhich suggests that adding Global.asax is not a good idea and if you need to it should inherit from umbraco.Global. I tried this and it doesn't help. The original poster didn't get it to work either.</span>I tried renaming the Global.asax file that I added but MVC must be configured to look for this file because although the error went away anything in MVC doesn't work because the routing never gets set up. I don't know too much about MVC yet, so perhaps there is a way to configure this that I haven't found.</span>Is it possible to get MVC and Umbraco to play nicely together, or do I have to use Webforms?</span>Regards,
    Brian.
    </span>

  • dub.survivor 58 posts 38 karma points
    Jul 02, 2009 @ 03:13
    dub.survivor
    0

    Maybe I should give up trying formatting,

    I am trying to add some functionality to my existing Umbraco website and I thought it would be an ideal opportunity to try out some asp.net MVC but I can't get it to work. Has anybody managed to achieve this. I needed to add a Global.asax file so that I can set up the routing stuff, but I get an error:

    I found a post about this error on the old forum http://forum.umbraco.org/yaf_postst8122_Error-regraging--ASPglobalasax-file.aspx

    which suggests that adding Global.asax is not a good idea and if you need to it should inherit from umbraco.Global. I tried this and it doesn't help. The original poster didn't get it to work either.I tried renaming the Global.asax file that I added but MVC must be configured to look for this file because although the error went away anything in MVC doesn't work because the routing never gets set up. I don't know too much about MVC yet, so perhaps there is a way to configure this that I haven't found.

    Is it possible to get MVC and Umbraco to play nicely together, or do I have to use Webforms?

    Regards,
    Brian

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Jul 02, 2009 @ 05:12
    Aaron Powell
    1

    Yeah the formatting does tend to freak out pretty bad!

    There's a blog post on how to do this here: http://memoryleak.me.uk/2009/04/umbraco-and-aspnet-mvc.html but I personally haven't ever tried it.

    The problem you seem to be showing is that you have your own Global.asax which can't be done because Umbraco already has its own. You can create your own class that inherits HttpApplication (which Global.asax does) and then implement the method(s) you need from it.

    Personally I'd stick with web forms, it could get messy to achieve it properly anyway.

    And FYI, Umbraco v5 is going to be a rewrite in MVC, but you'll be waiting about 18 months before that'll be really available

  • Lee 1130 posts 3088 karma points
    Jul 02, 2009 @ 07:50
  • dub.survivor 58 posts 38 karma points
    Jul 02, 2009 @ 21:40
    dub.survivor
    0

    @slace and Lee,

    Thanks for pointing me at these posts. I got it working - sort of- with a combination of these two posts. I decided however that I would take slace's advice and stick with webforms. Even though I got it working in some areas, there were other areas where things didn't work properly. I was trying to use a master page that I had made for the umbraco site and although it is possible to do this with asp.net MVC there were some issues with things like umbraco macros and even though I had written the master page so that it wasn't wrapped completely in a server form there were still some issues with a couple of controls. I think that I could maybe improve on what wasn't working properly, but I think it would be too messy and difficult to maintain. I think that I will use another project to try out MVC as a clean web application. I like what I am seeing in MVC and it will be interesting when umbraco is rewritten to MVC.

     

    Regards,
    Brian.

Please Sign in or register to post replies

Write your reply to:

Draft