[RESOLVED]MVC & External Controllers

I am new to MVC so this is a basic question. I have the following two projects:

1) A Web API that was generated with the PLINQO-EF (LINQ to SQL for Entity Framework) template for CodeSmith.

2) An MVC application using Kendo.

Project 2) needs to use the controllers which reside in project 1). My question is how to use the controllers from project 1) without moving the controllers to project 2), i.e. combining the projects.

Note that I can call the Web API from project 2) via PostAsJsonAsync. However, I want to be able to use constructs like

<siteMapNode controller="grid" action="index" title="my title" area="myarea"/>

hufaun

However, I want to be able to use constructs like

<siteMapNode controller="grid" action="index" title="my title" area="myarea"/>

And why you can put this construct?

You should use your other project as an external url in your sitemap

<siteMapNode
title="my
title
"
url="/virtualdirectory/myaread/grid/index"
/>

Hi hufaun,

Since these projects are independent of each other, in my opinion, you can’t able to access the Web API directly, you need to call it through
HttpClient class.

For the siteMapNote, you need to specify the absolute URL. If these projects are under a website, you could refer to
pprasannak’s solution.

Best Regards

Starain Chen

Leave a Reply