• Products

    Microsoft .NET

    Microsoft .NET components, libraries & tools

    • EmailVerify for .NET
      Email validation library, featuring full IETF-compliant syntax validation, DNS checking, mailbox existence test and tools for advanced batch processing.
    • ProxyClient for .NET
      Powerful proxy client library with support for SOCKS 4, SOCKS 4a, SOCKS 5 and HTTP proxy servers, allowing to establish and accept remotely proxied connections.
    • MVC Extensions
      Powerful routing engine extensions for ASP.NET: allows to declare routes by way of attributes applied to MVC actions and generates URLs using compiler-safe lambda expressions.

    Microsoft Silverlight

    Microsoft Silverlight components, libraries & tools

    • EmailVerify for Silverlight
      Email validation library with Data Annotations support, featuring advanced syntax verification, ISP-specific syntax checks and disposable email address handling.

    Microsoft Visual Studio extensions

    Development tools, integrated into your favorite IDE

    • Routing Assistant
      FREE

      A cool and free Visual Studio extension which allows to easily browse, define, match and filter ASP.NET MVC routes within ASP.NET applications and web sites.

  • Purchase

    Products

    • EmailVerify for .NET
      • Licensing / editions
      • Volume discounts
      • Upgrades
      Purchase
    • ProxyClient for .NET
      • Licensing
      • Volume discounts
      • Upgrades
      Purchase
    • MVC Extensions
      • Licensing
      • Volume discounts
      • Upgrades
      Purchase

    Request a quote

    • Contact us
      Send a request to our sales staff.

  • Support

    Knowledge base

    • Browse the knowledge base
      Support documents for our products and services.

    Request support

    • Contact us
      Send a request to our customer support staff.

  • About us

    About Cobisi

    About our company, our team, our mission

    • Our company
      Cobisi company information.
    • Our mission
      About what we aim to achieve.
    • Follow us
      Follow us on Twitter.

    Contact us

    • Contact us
      Send a request to our customer support staff.

  • Company blog

    Latest posts from our blog

    Shared thoughts about our technologies, products and services

    • Routing Assistant reached version 1.7
      Published on Thursday, March 21, 2013

    • Verifalia: a new, complete hosted email validation service
      Published on Thursday, December 6, 2012

    • Routing Assistant v1.4 released
      Published on Friday, October 12, 2012

Knowledge base

Knowledge base for Cobisi's products and services

  • Contact us
  • Knowledge base

How to support MVC areas within the declarative routing model

  • Knowledge base
  • » MVC Extensions

MVC areas is a cool feature introduced back with ASP.NET MVC version 2.0, which allows to easily structure models, views and controllers of ASP.NET MVC applications into their own subfolders, for an easier management. MVC Extensions develops this concept even further and allows to define routes by way of the Route attribute, giving the developer the freedom to structure models and controllers independently of their routes and, thus, the locations of their views.

Starting from version 1.3.5.709, however, MVC Extensions supports mixed configuration where declarative routes are applied to MVC actions which are contained in an MVC area as well. To take advantage of that, the declarative routing engine must be notified of any eventual MVC area it needs to support, before the related routes are registered. A single line of code is enough to achieve this behavior: an invocation to the RegisterArea() method of the DeclarativeRouteRegistration class, right from the target area registration code, as shown below for a fictitious "Baz" area:

    public class BazAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "Baz";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            DeclarativeRouteRegistration.RegisterArea(this,
                context,
                // Default namespace for the area, for locating views:
                "FooBar.Areas.Baz.Controllers");

            // Not needed my the declarative routing engine, but you may want
            // to leave it here for something else.

            context.MapRoute(...);
        }
    } 


Apart from the target AreaRegistration and the current AreaRegistrationContext, RegisterArea() accepts a default namespace prefix, which is used to locate views when View() is called within action methods that are accessed by way of a declarative route.


Not what you are looking for?

Please don't hesitate to contact us if you have problems with any of our products or services; technical support is always free of charge, and requests made by registered clients will have higher priority.

Contact us
Products
  • EmailVerify for .NET
    • Features
    • Online demo
    • Download
    • Licensing / editions
    • Release notes
    • Purchase
  • ProxyClient for .NET
    • Download
    • Licensing / editions
    • Release notes
    • Purchase
  • MVC Extensions
    • Tutorial
    • Free edition download
    • Licensing
    • Release notes
    • Purchase
Support
  • Knowledge base
  • Request support

About Cobisi
  • The company
  • Mission
  • Follow us
  • Contact us
Copyright © 2005-2022 Cobisi Research. All rights reserved.
Cobisi Research - Via Della Costituzione, 31 - 35010, Vigonza - Italy (European Union)
VAT ID: IT04391160282