I want to call an action method (DownloadPictures) after i redirect to a different page, so i use the refresh header
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"));
And my Download Pictures method looks like this with a breakpoint set on the first line, but this method never gets called
public ActionResult DownloadPictures ( bool? isFree ) {
Cart cart = (Cart)HttpContext.Session["_cart"];
....
//The Download Picture Method returns a File (a zip file)
}
开发者_Go百科Any help would be appreciated. Thanks
Most browsers ignore the refresh header
Use another method like javascript etc
e.g.
<html>
<head>
<script type="text/javascript">
function delayRedirect()
{
window.location = "/DownloadPictures";
}
</script>
</head>
<body onLoad="setTimeout('delayRedirect()', 1000)">
...
</body>
</html>
精彩评论