c# - How to send url segment as parameter to action method? -
in mvc web app route urls 1 url segment same controller action. example:
http://example.com/onepage
here's action method in controller:
public actionresult someaction(string urlsegment) { ... }
now, want url segment (like "onepage" example), sent input action method.
can show maproute should make happen?
it this.
routes.maproute( "urlsegment", // route name "{urlsegment}", // url parameters new { action="someaction",controller="controllername" }, // parameter defaults new[] { "namespace.controllers" } // controller namespaces);
i'm on phone unfortunately can't verify should you're looking for.
Comments
Post a Comment