CloudAnywhere
CloudAnywhere

Reputation: 759

MVC4 construct url with controller/parameter/action

have a look to the following URL: https://manage.windowsazure.com/@MYCOMPANY.onmicrosoft.com#Workspaces/CloudServicesExtension/CloudService/MYSERVICENAME/dashboard

It looks like the url is in the form {controler}/ActionName/{parameter}/ActionName

How can I generate such URL in MVC4/Razor? Indeed, I want to build url in the form: http://www.myservice.com/Configuration/{Source or Target}/{DomainName}/{ConfigurationType}

ex:

http://www.myservice.com/Configuration/Source/mydomain.com/ConnexionConfiguration http://www.myservice.com/Configuration/Source/mydomain.com/AttributesConfiguration

Thanks.

Upvotes: 0

Views: 92

Answers (1)

flumeware
flumeware

Reputation: 136

You can either create per action routes, for each action, or include the controller name and action name in the url and then use something like this:

routes.MapRoute("Default","{controller}/{source}/{domain}/{action}")

so a controller called Configuration with an action called Setup and a domain of example.com and source of welcome would be

/Configuration/welcome/example.com/setup

Upvotes: 1

Related Questions