2011-03-07 56 views
0

我要调用的操作方法(DownloadPictures)后,我重定向到一个不同的页面,所以我使用刷新头ASP.NET MVC刷新头问题

UrlHelper url = new UrlHelper(Request.RequestContext); 
Response.AddHeader("REFRESH" , "1;URL=" + url.Action("DownloadPictures" , "Cart" , new { isFree = true })); 
return Redirect(returnUrl != null ? returnUrl : url.Action("Index", "Home")); 

而且我下载的图片的方法看起来是这个样子一个断点设置在第一行,但这种方法永远不会被称为

public ActionResult DownloadPictures (bool? isFree) { 
    Cart cart = (Cart)HttpContext.Session["_cart"]; 
    .... 
    //The Download Picture Method returns a File (a zip file) 
} 

任何帮助,将不胜感激。由于

回答

2

大多数浏览器忽略刷新头

使用像JavaScript等

例如,另一个方法

<html> 
<head> 
<script type="text/javascript"> 
    function delayRedirect() 
    { 
    window.location = "/DownloadPictures"; 
    } 
</script> 
</head> 
<body onLoad="setTimeout('delayRedirect()', 1000)"> 
... 
</body> 
</html>