c# - Custom routes rendering with Html.BeginRouteForm -


i'm using custom route mapping in following way:

    context.maproute(         "customroute",         "area/{controller}/{id}",         new { controller = "task", action = "index", id = urlparameter.optional },         new { id = @"\d+", httpmethod = new httpmethodconstraint("get") }     ); 

with above route i'm going skip action name, pass parameter via slash /, expect have url in following way: domain.com/area/task/982

it works entering url manually. trying same via @html.beginrouteform helper:

    @using (html.beginrouteform("customroute", new { id = model.id }, formmethod.get))     {       @html.textboxfor(m => m.id)       <button class="btn btn-default btn-sm" type="submit">get data</button>     } 

submitting form rendering url in way: domain.com/area/task?id=982

what missing above? how can achieve desired custom route?


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -