Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6374261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:27:57+00:00 2026-05-25T01:27:57+00:00

I am doing some plugin kind of work using asp.net mvc. I have two

  • 0

I am doing some plugin kind of work using asp.net mvc.
I have two plugins(mvc projects) Say users and home. In both the plugins, I have Home Controllers. Yes the names are home controller in both the plugins(projects). When I build the project the Dlls are copied to the host project (third one).

this is home plugin

namespace Plugin.Home.Controllers
{
public class HomeController : Controller
{
    public string Index()
    {
        return "Home from home";
    }

    public string JustATest()
    {
        return "Just a test from home";
    }

}
}

Here is another controller in different project(User Plugin)

this is home controller

namespace Plugin.Users.Controllers
{
public class HomeController : Controller
{
    public string Index()
    {
        return "Home from Users";
    }

    public string JustATest()
    {
        return "Just a test from Users";
    }

    public string JustAnotherTest()
    {
        return "Just another test from Users";
    }

}
}

In global.asax I have register routes using namespaces.

routes.MapRoute(
        "Default", // Route name
        "Home/{action}/{id}", // URL with parameters
        new { controller = "Home", action = "Index", id = UrlParameter.Optional },     
 new[] { "Plugin.Home.Controllers" }

routes.MapRoute(
           "Users", // Route name
           "users/{action}/{id}", // URL with parameters
           new { controller = "Home", action = "Index", id = UrlParameter.Optional },     new[] { "Plugin.Users.Controllers" }
       );

I can access all the routes in the browser without any problem.

Now the problems

  1. I try to use @{Html.RenderAction(“JustATest”,”Home”);}
    It only renders from the home controller in home module. How can i render it from Users module.

  2. It throws an exception saying method not found in home controller,
    when I say @{Html.RenderAction(“JustAnotherTest”,”Home”);}

At what stage I can check if a given controller has the given method or not (Some ControllerFactory). Or how can i make sure it picks up the right controller.

Help will be appreciated.

Regards

Parminder

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:27:58+00:00Added an answer on May 25, 2026 at 1:27 am

    If you really need to save controller names both HomeController, i see simple solution to use hack like this:

    routes.MapRoute(
            null,
            "{home}/{action}/{id}", 
            new { controller = "Home", action = "Index", home="Home", id = UrlParameter.Optional });
    routes.MapRoute(
            null,
            "{home}/{action}/{id}", 
            new { controller = "Home", action = "Index", home="Users", id = UrlParameter.Optional }
           );
    

    And you can access to this actions both by url and with RenderAction:

    @{Html.RenderAction("JustATest","Home", new {home="Home"});}
    @{Html.RenderAction("JustATest","Home", new home="Users");}
    

    But I think that problem is artificial (because it is more hard that you imagine), and you use means only for using means, but not for solving real problem. For real plugin architecture you need to create at least:
    1. Custom Route Constraint for checking, that controller type is from assembly, where controller was defined.
    2. Installer, that will install all routes independently of main application
    3. Create unit tests for each plugin application Routes to ensure that all routes, that was installed from plugins, that do not know anything about each other, works properly (and don’t break each other).

    I recommend to take your controllers at main web application and give them different names.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Doing some jquery animation. I have certain divs set up with an attribute of
After doing some work with Ruby, Rails, and RSpec last summer and I learned
While doing some refactoring I've found that I'm quite often using a pair or
Been doing some playing call my service which is on a different domain using
While doing some small regex task I came upon this problem. I have a
I am doing some work for a French client and so need to deal
I just started using eclipse for some personal projects and am finding the transition
I am using the Uploadify Plugin to upload the picture, and i am doing
I've created a plugin doing some crud operations. In the web-app/images/icons folder I've got
I have a working Spring MVC application(doing everything I wanted when deployed to jboss)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.