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

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -