I try to use URLHelp.RouteUrl with dynamic string in javascript. I want it in this way -
function MyFun(action, param){
var strPass = "MyController/" + action + "?param1=" + param;
Windows.Location.href = "<%=Url.RouteUrl(" + strPass + ")%>";
}
It does not work. Have I missed anything? Do we have alternative way in ASP.NET MVC to work in a similar way?
Thanks,
Additional info -
I try the above way because I have a problem from my application - the main page has "http://myserver/myapplicaiton/mycontroller/myaction" correctly return when I use "Windows.Location.href ="MyController/MyAction". But the next page having double controller appeared "http://myserver/myapplication/mycontroller/mycontroller/myaction".
What causes this routing problem?