Where is the documentation to limit existing routing in ASP.NET MVC5 +?

Studying the history of processing a region in MVC6, I save the blog posts closest through the blog that have a route pattern, but no matter how hard I search, I can’t find anything about this in any Microsoft documentation, and not a single blog post that I found explain what he is doing or mention where this bit of information came from.area:exists

Where is this restriction explained, and where is the comprehensive, up-to-date canonical documentation for the built-in route patterns and restrictions? For the record, I know this page , but it is structured more like a textbook than a canonical link.

If someone from Microsoft reads this, http://www.asp.net/mvc/overview/api-reference leads to a page with the following information and an unwritten table of contents that I cannot find what I want. And your link to RouteAttributehas no links to anything explaining what the URL pattern should look like.

EDIT

So, after some deepening, I found the following: https://github.com/aspnet/Mvc/blob/48bfdceea6d243c5ec8d6e00f450f8fe7cce59f7/src/Microsoft.AspNet.Mvc.Core/MvcCoreRouteOptionsSetup.

So this is due to KnownRouteValueConstraint, which led me to the following: https://github.com/aspnet/Mvc/blob/e0b8532735997c439e11fff68dd342d5af59f05f/src/Microsoft.AspNet.Mvc.Core/KnownRouteValueConstraint.cs#26-

, , , . , .

+4
1

ASP.NET 5/MVC 6 , API , , .

, ASP.NET vNext , , , , , . , area:exists.

[Fact]
public async Task RoutingToANonExistantArea_WithExistConstraint_RoutesToCorrectAction()
{
    // Arrange
    var server = TestHelper.CreateServer(_app, SiteName, _configureServices);
    var client = server.CreateClient();

    // Act
    var response = await client.GetAsync("http://localhost/area-exists/Users");

    // Assert
    Assert.Equal(HttpStatusCode.OK, response.StatusCode);
    var returnValue = await response.Content.ReadAsStringAsync();
    Assert.Equal("Users.Index", returnValue);
}

[Fact]
public async Task RoutingToANonExistantArea_WithoutExistConstraint_RoutesToIncorrectAction()
{
    // Arrange
    var server = TestHelper.CreateServer(_app, SiteName, _configureServices);
    var client = server.CreateClient();

    // Act
    var response = await client.GetAsync("http://localhost/area-withoutexists/Users");

    // Assert
    var exception = response.GetServerException();
    Assert.Equal("The view 'Index' was not found." +
                 " The following locations were searched:__/Areas/Users/Views/Home/Index.cshtml__" +
                 "/Areas/Users/Views/Shared/Index.cshtml__/Views/Shared/Index.cshtml.",
                 exception.ExceptionMessage);
}
+2

All Articles