I want to Add Url.Action With Variable
<script type="text/javascript"> var a = Account; Var b = Index; window.location.href = '@Url.Action("a", "b")'; </script>
Hi ruben00000,
In the @Url.Action() method you can not pass a client side value to it as a parameter.
So use like below.
<script type="text/javascript"> var a = 'Account'; var b = 'Index'; window.location.href = "/" + a + "/" + b + "/"; </script>
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.