c# - How to remove Home from HomeController in Mvc -


i have homecontroller , has many actions in it. users visit actions without typing home. here route below

routes.maproute(             name: "default",             url: "{controller}/{action}/{id}",             defaults: new { controller = "home", action = "index", id = urlparameter.optional }         ); 

i users not enter controller name, home in case. how can that? or mandatory?

you can add custom route before defult route this:

routes.maproute(         "onlyaction",         "{action}",         new { controller = "home", action = "index" }      );  routes.maproute(             name: "default",             url: "{controller}/{action}/{id}",             defaults: new { controller = "home", action = "index", id = urlparameter.optional }     ); 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -