I have created a mvc application, its working fine, now I want to add some route based on xml, I don't want to create action based on that, that will work on fly.
i.e. www.lmenaria.com/site1 this will redirect to www.site1.com www.lmenaria.com/site2 this will redirect to www.site2.com www.lmenaria.com/site3... this will redirect to www.site3.com
No action Site1, site2, site3 lmenaric.om, so what will be the route and how can I redirect to external site.
You can do this on controller with only one action but you need a route constraint for that o/w you will end up routing all the request to the same action. Here is a sample:
Put this route at the top:
You route constraint should look like this:
I put up a dummy logic there for allow sites but how you get that data is up to you.
The controller action:
I hope you got the idea.