I have a MVC4 project, and on the client side I need to redirect to a specific action method. I have read the following post How to redirect to action from JavaScript method?, and further down there's a comment about using:
window.location.href = "/{controller}/{action}/{params}";
and I had tried that already but it's not working for where my project is installed in IIS.
My project has been published to: http://localhost/SomeName.SomeOtherName/
and I need to get to: http://localhost/SomeName.SomeOtherName/Home/Logout
When I use the '/Controller/Action' as recommended from the previous post I get to here: localhost/Home/Logout
and this isn't correct.
I've tried to keep the published location (same as publish string above) in a web.config file and build the string (concatenate: publish location + '/Home/logout'), but that didn't work either. Below is the stmt that I'm using for this. What's weird is that this just concatenates the current page's url with my built url. Not only is this invalid, but I also get one of those 'potentially dangerous request.path...' errors.
window.location.href = "\"" + url + "/Home/logout" + "\"";
The same thing happens if I use $(location.hostname) to build my string.
Any thoughts?