Use the Controller's Redirect() method.
public ActionResult YourAction()
{
// ...
return Redirect("http://www.example.com");
}
Update
You can't directly perform a server side redirect from an ajax response. You could, however, return a JsonResult with the new url and perform the redirect with javascript.
public ActionResult YourAction()
{
// ...
return Json(new {url = "http://www.example.com"});
}
$.post("@Url.Action("YourAction")", function(data) {
window.location = data.url;
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…