asp.net mvc - Adding a parameter to the URL in ASP MVC -


Before my ASP MVC URL before I need a parameter as part of the controller and action :

company1 / home

or

company1 / customer / description / 1

(Ideally I would like to place it as a sub-domain like this: http: // company1 . Mydomain.com / Customer / Details / 1 Therefore, to solve it Any answer is also appreciated)

I will call this parameter account Calling I tried to add something like this on the routing map: "{account} / {controller} / {action} / {id}" but gives me a 404 error such as

register rots here In Global. ASX:

  Public Fixed Blank Register Routes {routes.IgnoreRoute ("{resource} .axd / {* pathInfo}"); Routes.MapRoute ("TestRoute", "{account} / {controller} / {action} / {id}"); New {controller = "home", action = "index", id = ""} with routes ("default", // root name "{controller} / {action} / {id}", // URL parameter / Parameter defaults); }  

What do I need to do when organizing my view folder or controller functions?

Your error seems that you are not giving a default to action in your route defaults.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -