Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Anyone manage to get MVC 3 working with Kentico 6? View modes: 
User avatar
Member
Member
nrussell - 4/13/2012 5:03:36 PM
   
Anyone manage to get MVC 3 working with Kentico 6?
I'm trying to integrate a small mvc application in a Kentico site. Played around with the News example that ships with Kentico 6 and following the docs wired in my own controller and view. At that point I ran into a problem because my MVC site is using the MVC 3 and Kentico has bundled MVC 2. I tried upgrading the dll in Kentico to MVC 3 but that broke MVC routing completely and the only error I get is a 404 when I access MVC routes that used to work (including News).

Has anyone manged to get MVC 3 working with Kentico?

Thanks,
Neil

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 4/18/2012 3:19:56 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
Hi,

Which version of Kentico CMS have you installed? I mean, which .Net version?

Kentico with .NET4 should be compatible with MVC3 (however, it was not fully tested).

Best regards,
Juraj Ondrus

User avatar
Member
Member
nrussell - 4/18/2012 11:17:46 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
The site was created as .NET4/VS2010 web application project using the 6.0 installer and patched to the latest version (6.0.27).

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 4/19/2012 5:59:52 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
Hi,

Could you please send us any samples of your routing code? We tried it again on the News sample with MVC3 and it is working fine.

Thank you.

Best regards,
Juraj Ondrus

User avatar
Member
Member
nrussell - 4/24/2012 12:37:39 PM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
I am able to reproduce the error using the NewsMVCController that is included with Kentico. I created a new webapp tested the news controller and it worked, removed system.web.mvc (2.0) from references and added system.web.mvc (3.0) restarted the project and get a 404 exception.

I'll try creating a new kentico webapp project and try again in case I did something else that caused it to break.

Neil

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 4/25/2012 1:34:57 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
Hi,

Just to be sure - have you also updated the System.Web.Routing.dll file?


Best regards,
Juraj Ondrus

User avatar
Member
Member
nrussell - 4/26/2012 1:53:12 PM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
I am using version 4.0.0.0 of System.Web.Routing that is included with version 4 of the .net framework.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 5/2/2012 11:37:13 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
Hi,

I am sorry for the delay, there was a public holiday here.
We have tried using MVC 3 on the source code solution of Kentci CMS as well as web project and web application builds and it is working fine.

Would it be possible to send us exactly what and where are you using or, the whole web application you have right now so we can inspect it (to our support e-mail)?

Best regards,
Juraj Ondrus

User avatar
Member
Member
F Khan - 6/27/2012 6:29:15 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
Hey,
I have had the same issue when I added all the required assemblies for MVC 3 and couldn't find any solution but when I removed reference of System.Web.MVC (v3.0) and added back to only System.Web.MVC v2.0 its work fine even rest of the assemblies were pointing to the version 4. I think this issue can be recreated if you build another controller and view with NewsMVC.

Please keep posted.


Thanks

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 6/27/2012 9:59:23 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
Hi,

Could you please exactly describe what was not working and what have you done and what were you using? Our testers tried using the MVC3 e.g. on the sample Corporate site we have and it was working just fine. If you could provide us with more details, that would be great.

Best regards,
Juraj Ondrus

User avatar
Member
Member
F Khan - 6/27/2012 10:40:58 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
Hey thanks for getting back to me.

I am using Kentico v6.0.24 initially I removed all the MVC's references which were there already then I added new assembly references so my web config finally look like this.

<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Then I added a new controller called 'TestController' having Index as Action therefore I added Index as view as well.

My CMS settings for view are as follows.

Path or Pattern:Test/Index
Default controller: Test
Default action: Index
Culture: English - United Kingdom

**I have tried with wild cards as well like {controller}/{action} but same result.


I have a hyper link same as 'News MVC' example which will take me to the index view.

Finally I run the application when ever I try to navigate the view I get the following error.

HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.


But if I remove System.Web.Mvc(3.0.0.0) then add back to System.Web.Mvc(2.0.0.0) I wont be getting any error.

This is the only assembly making a big difference in an output.

I don't why it's happening to my copy. Is there any thing with my routing?.

Hope I made some sense.

Thanks






User avatar
Kentico Support
Kentico Support
kentico_jurajo - 7/10/2012 12:54:05 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
Hi,

I am sorry for the delay.
We have tested it again and it is working just fine for us. Either using the sample NEWS or also creating a simple custom MVC route.
Was the web project rebuilt after you added your custom MVC?

Best regards,
Juraj Ondrus

User avatar
Member
Member
jeff-consultutah - 8/31/2012 11:46:01 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
I'm having the same issue here... I'm just using the NewsMVC controller for now and can't seem to get it hooked up.

Here is the configuration I have:
User image

When I go to any of the following, I get 404:
* http://localhost/NewsMVC
* http://localhost/NewsMVC/List
* http://localhost/NewsMVC/List.aspx


User avatar
Member
Member
jeff-consultutah - 8/31/2012 11:46:52 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
Apparently that image link didn't work: User image

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 9/3/2012 2:04:55 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
Hi,

How was the MVC3 added?
Have you rebuilt the web project?

We have tested it in the default Newsmvc example as well as with custom MVC page and it is working just fine on our end.

Best regards,
Juraj Ondrus

User avatar
Member
Member
jeff-consultutah - 9/3/2012 12:48:43 PM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
It only sort of works. I got past the 404's by modifying CMCHttpApplication:


public void Application_Start(object sender, EventArgs e)
{
// Azure Application start init
AzureInit.Current.ApplicationStartInit();

CMSAppBase.CMSApplicationStart();

RegisterRoutes(RouteTable.Routes);
}

public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");

routes.MapRoute(
"Default", // Route name
"MVC/{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
}


But I still get errors that I don't think I should:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using System.Web.Mvc; //NOTICE Namespace is already included
using System.Web.Security;
using Web.Models;
using Data.Utilities;

namespace Web.Controllers
{

[System.Web.Mvc.Authorize] // NOTICE I had to add System.Web.Mvc here?
public class AccountController : Controller
{
public ActionResult Index()
{
return ContextDependentView();


User avatar
Kentico Support
Kentico Support
kentico_jurajo - 9/7/2012 7:21:24 AM
   
RE:Anyone manage to get MVC 3 working with Kentico 6?
Hi,

What kind of errors are you getting?
When you added the MVC3, was the project build in Visual Studio? As mentioned earlier in this thread, it is working fine on our end using the sample controller as well as when creating a custom one using MVC3.

Best regards,
Juraj Ondrus