New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Routing #61
Comments
I know this is probably the wrong place to ask, but does ASP.NET 5 support attribute routing (ie. defining routes as attributes on the controllers/actions rather than in one giant config file)? |
yes, MVC 6 does |
Oh cool, thanks! I'm currently using MVC 4, I didn't realise that attribute routing is actually built into the framework starting from MVC 5 (and MVC 6 has the same attributes) |
We should probably also mention common conflicts with routing and IIS:
|
This may be the wrong place to ask, but would a third party person pick up an issue such as this one to work on it? The contributing guidelines say to open up a new issue, but there are many open issues that I would be interested in working on. Should I just work on one then submit a pr? |
@danroth27 by "Routes with dots" you are talking about route templates correct? Or does this apply to route names too? Also, I'd like to contribute to some type of migration documentation. I'm working on moving an MVC5 application to MVC6 and hit some major roadblocks due to discontinued features. As I find the way to implement my features in 6 I'd like to share those with others. Where would I contribute these things? |
Yeah, route templates, things like these ones I use on my site:
|
One of the issues I've had problems with ASP.NET MVC (4+) and IIS is handling making custom Not Found and Error pages is all cases. We eventually went with web server directives. Would a middleware piece be appropriate for this? |
All these links are to AspNetCore / RC2 files; should I target RC2 with this article or ? @danroth27 @rynowak |
Target RC1. I moved the post-RC1 stuff to a separate issue: #986 |
@rynowak what is the purpose of DefaultHandler and ServiceProvider on RouteBuilder? They don't seem to be used anywhere except the sample project. |
Nevermind, it seems to be necessary for extension methods to work, such as MapRoute() |
@rynowak From our discussion (notes above): "If a route has default values that don't match a parameter and that value is explicitly provided it must match the default value." This relates to link generation. thanks |
Here's the example:
This will only generate a link when the matching values for controller and action are provided. |
Homepage fixes
ASP.NET 5->Fundamentals->Routing
IRouteHandler
IRouteHandler
returns aRequestDelegate
or null{controller=Home}/{action=Index}/{id?}
=
defines a default value. If the path segment is not present then the default value is added to the route values?
defines an optional value:
to add inline constraints{id:int:range(0,100)}
{value:foo|bar|baz}
)*
to bind to the rest of the URI. Ex/blog/{*slug}
{id?}/{foo}
{mm}-{dd}-{yyyy}
/files/{filename}.{ext?}
RouteBuilder
via theRoute
classIRouteConstraint
implementationsThe text was updated successfully, but these errors were encountered: