asp.net mvc - .NET MVC routing using attributes only -
does know how create route in .net mvc contains attributes only? code follows:
[route("{listingcategorydescription}/")] public actionresult categorysearch(string listingcategorydescription) {
as can tell want url contain category. possible? or need hard code @ least 1 part of route?
many thanks.
are wanting category passed in @ root url? http://localhost/apples?
if so, work, collide other routes.
public class categoriescontroller : controller { [route("{listingcategorydescription}")] public actionresult index(string listingcategorydescription) { return content("you picked category: " + listingcategorydescription); } }
Comments
Post a Comment