Redirect to new page from Server for ASP.Net MVC Ajax Request
<p>I'm trying to call a method from another controller using <code>RedirectToAction()</code>. But it doesn't work. Could you please explain, what I'm doing wrong?</p>

<pre><code>[HttpPost]
public ActionResult AddToWishList(int id, bool check)
{
    var currentUser = WebSecurity.CurrentUserId;
    if (currentUser != -1)
    {
        // ...              
    }
    else
    {
        return RedirectToAction("Login", "Account");
    }            
}
</code></pre>

<p>I call the method in HTML:</p>

<pre><code>&lt;script&gt;
$(document).ready(function () {
    /* call the method in case the user selects a checkbox */
    $("#checkbox".concat(@Model.Id)).change(function () {
        $.ajax({
            url: '@Url.Action("AddToWishList", "Item")',
            type: 'POST',
            data: {
                id: '@Model.Id',
                check: this.checked
            }
        });
    });
});
</code></pre>

<p></p>

<p>It works if I use:</p>

<pre><code>success: function (result) {
    window.location.href = "@Url.Content("~/Account/Login")";
}
</code></pre>

<p>But I don't need to navigate to the Login() after every click, only if the user is not authorized. Could you please explain how I can use redirect in the controller?</p>