title: Redirecting to action from javascript
body: <p>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 <a href="https://stackoverflow.com/questions/5336858/how-to-redirect-to-action-from-javascript-method">How to redirect to action from JavaScript method?</a>, and further down there's a comment about using:</p>
  
  <pre><code>window.location.href = "/{controller}/{action}/{params}";
  </code></pre>
  
  <p>and I had tried that already but it's not working for where my project is installed in IIS.</p>
  
  <p>My project has been published to: <code>http://localhost/SomeName.SomeOtherName/</code></p>
  
  <p>and I need to get to: <code>http://localhost/SomeName.SomeOtherName/Home/Logout</code></p>
  
  <p>When I use the '/Controller/Action' as recommended from the previous post I get to here: <code>localhost/Home/Logout</code> and this isn't correct.  </p>
  
  <p>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.  </p>
  
  <pre><code> window.location.href = "\"" + url + "/Home/logout" + "\"";
  </code></pre>
  
  <p>The same thing happens if I use $(location.hostname) to build my string.</p>
  
  <p>Any thoughts?</p>