Code Monkey home page Code Monkey logo

Comments (5)

mccalltd avatar mccalltd commented on September 18, 2024

Is there any reason why you did not use the RouteArea attribute on the
controller? That's where area support comes in.

On Sep 7, 2011, at 6:37 AM, jansaris
[email protected]
wrote:

Hi,

I have found an issue in the area routing.
If you add a controller to the area routing which starts with the same name as the area, the routing goes wrong.

So in your demo project you have an area called Admin.
I've added the following controller:

public class AdministratorController : AdminControllerBase
{
[GET("Administrators")]
public ActionResult Index()
{
return View();
}
}

I've added the corresponding View.

I assume that the following route will be added to the routing table:
http://localhost/Admin/Administrators
But instead the following route is added to the routing table:
http://localhost/Administrators

Could you please look in to this issue?

Thanks
Jan Saris

Reply to this email directly or view it on GitHub:
#15

from attributerouting.

jansaris avatar jansaris commented on September 18, 2024

In my example I've used this git-hub example application (AttributeRouting.Web.csproj).
If you look in the example code, you see that the baseclass: AdminControllerBase contains the RouteArea attribute.

[RouteArea("Admin")]
public class AdminControllerBase : ControllerBase
{
}

And my code uses this baseclass:

public class AdministratorController : AdminControllerBase
{
[GET("Administrators")]
public ActionResult Index()
{
return View();
}
}

But if I put the RouteArea attribute directly on this class (without use of the base-class) the issue also occurs.

from attributerouting.

mccalltd avatar mccalltd commented on September 18, 2024

Cool. Thanks for the follow up. I'll check it out.

On Sep 8, 2011, at 3:11 AM, jansaris wrote:

In my example I've used this git-hub example application (AttributeRouting.Web.csproj).
If you look in the example code, you see that the baseclass: AdminControllerBase contains the RouteArea attribute.

[RouteArea("Admin")]
public class AdminControllerBase : ControllerBase
{
}

And my code uses this baseclass:

public class AdministratorController : AdminControllerBase
{
[GET("Administrators")]
public ActionResult Index()
{
return View();
}
}

But if I put the RouteArea attribute directly on this class (without use of the base-class) the issue also occurs.

Reply to this email directly or view it on GitHub:
#15 (comment)

from attributerouting.

mccalltd avatar mccalltd commented on September 18, 2024

Nice catch! Fixed in v1.1, which is available as a tasty nuget update.

from attributerouting.

jansaris avatar jansaris commented on September 18, 2024

Thanks a lot for your real quick support!

from attributerouting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.