c# - How to redirect by common routing -


i have action

public actionresult edit(int id) 

i need redirect action index if id null. how in routing?

i tried:

routes.maproute(                 name: "redirect empty controller/edit controller/list",                 url: "{controller}/edit",                 defaults: new { controller = "home", action = "index" }             ); 

but not helped.

hmm not sure on routing, if helps use return redirecttoaction("index", "home"); (where index action method , home controller want access on).


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -