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

  • Home
  • SEARCH
  • 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 8085993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:18:56+00:00 2026-06-05T18:18:56+00:00

I recently came across a way to develop pluggable application modules when using ASP.NET

  • 0

I recently came across a way to develop pluggable application modules when using ASP.NET MVC3/4 and I loved the simplicity of the approach. Currently, I have my applications structured as follows:

enter image description here

Therefore, anyone wanting to develop an extension for my application, follows the approach from the above tutorial and creates an extension that stays in the Areas folder. I figure that when new Areas (created as new projects) are added, .pdb files are created and placed in the bin directory. My question is this:

  • How does one distribute the Areas as pluggable modules?
  • How do I change the following code so that when someone drops a new Area into the bin folder, the application automatically picks it up and creates a link? And what should the plugin author do to enable this?

In my _Layout.cshtml (global shared layout), I do the following to construct the links:

<ul>
      <li>@Html.ActionLink("Area1", "Index", "Area1", new { Area = "Area1" }, null)</li>
      <li>@Html.ActionLink("Area2", "Index", "Area2", new { Area = "Area2" }, null)</li>
      <li>@Html.ActionLink("Area3", "Index", "Area3", new { Area = "Area3" }, null)</li>
</ul>

For simplicity, assume that the area names are unique. Any suggestions on how to do this?

  • 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-06-05T18:18:57+00:00Added an answer on June 5, 2026 at 6:18 pm

    How does one distribute the Areas as pluggable modules?

    Don’t create the Areas in the hosting web app, but create separate projects, that compile to separate dll’s. Copy the dll’s to any web app where you want to use it. Remember to set all static files as “EmbeddedResource”.

    How do I change the following code so that when someone drops a new Area into the bin folder, the application automatically picks it up and creates a link? And what should the plugin author do to enable this?

    You can use MvcContrib PortableAreaRegistration’s “Bus” to send messages, commands from the portable area to anyone on the ‘bus’. That can be the hosting web app, or in theory independent Area’s can send message to each other.

    Created two crude, but functional demo of this, code on github:

    MVC3 version:

    https://github.com/AkosLukacs/PluggablePortableAreas

    MVC4 RC version:

    https://github.com/AkosLukacs/PluggablePortableAreasMVC4

    First, you define a message that can carry the information you need. Just a POCO that has some properties (PluggablePortableAreas.Common\RegisterAreaMessage.cs):

    public class RegisterAreaMessage : IEventMessage
    {
        public string LinkText { get; private set; }
        public string AreaName { get; private set; }
        public string ControllerName { get; private set; }
        public string ActionName { get; private set; }
        //...
    }
    

    Create a handler for that message type (PluggablePortableAreas.Common\RegisterAreaEventHandler.cs):

    public class RegisterAreaEventHandler : MessageHandler<RegisterAreaMessage>{}
    

    In this case, the MessageHandler just adds the received messages to a static ConcurrentBag<RegisterAreaMessage>. You can use DI, if you want to, but wanted to keep it simple.

    You can send the message from the portable area like this (Areas\DemoArea1\Areas\Demo1\Demo1AreaRegistration.cs):

     //the portable area sends a message to the 'bus'
     bus.Send(new RegisterAreaMessage("Link to the Demo area", AreaName, DefaultController, DefaultAction));
    

    The dynamically added links are displayed by iterating over the collection of messages(PluggablePortableAreas.Web\Views\Shared_Layout.cshtml):

                    @foreach(var sor in PluggablePortableAreas.Common.RegisterAreaEventHandler.RegisteredAreas) {
                    <li>@Html.ActionLink(sor.LinkText, sor.ActionName, sor.ControllerName, new{Area=sor.AreaName}, null)</li>
                    }
    

    One more thing to take care of: Use “fully qualified” Area names. If you don’t specify the area name explicitly, MVC assumes it’s the current area. No problems without areas, but the second will point to "/path_to_your_app/CurrentArea/Home" instead of "/path_to_your_app/Home".

    <li>@Html.ActionLink("Home", "Index", "Home", new { Area = "" }, null)</li>
    <li>@Html.ActionLink("I don't work from the portable area!", "Index", "Home")</li>
    

    Even one more thing to note!

    The development server in VS feels a bit “erratic”, sometimes the portable area doesn’t load. Works reliably in full IIS tho…

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

Sidebar

Related Questions

I recently came across a ASP 1.1 web application that put a whole heap
I recently came across a great data structures book, Data Structures Using C (c)
I've recently came across a very interesting inconsistency while using libxml++ (a C++ wrapper
Recently I came across this way to filter out every second value of a
Recently I came across a blog engine that works in quite unusual way. It
Recently I came across a .NET color chart based on their hue and brightness
Recently I came across a situation where, while using a double-byte language, I had
I recently came across new way to generate random numbers in C++11, but couldn't
I recently came across the problem of printing 4219 lines on console. but when
I recently came across a bit of not-well-tested legacy code for writing data that's

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.