简体   繁体   English

在同一回发中下载后刷新 ASP.NET 页面

[英]Refresh ASP.NET page after download in same postback

I use DotNetZip Library To Create Zip and Download File as a Zip File then, I want To Redirect or Refresh Same Page in Code behind, How Can O Do that(In Same PostBack)我使用 DotNetZip 库创建 Zip 并将文件下载为 Zip 文件,然后我想重定向或刷新后面的代码中的同一页面,O 如何做到这一点(在同一回发中)

ex:前任:

zip.Save(Response.OutputStream);
Response.Redirect(url,false);

I want to Refresh Page After Downloading file,but It doesnt refresh if I use Response.Redirect .我想在下载文件后刷新页面,但如果我使用Response.Redirect则它不会刷新。

Found Solution .I did that with using javascript,i had set time out in link button onclientclick event.找到解决方案。我使用 javascript 做到了这一点,我在链接按钮 onclientclick 事件中设置了超时。 OnClick="LinkButton1_Click" OnScript OnClientClick="JavaScript:AutoRefresh(5000);" OnClick="LinkBut​​ton1_Click" OnScript OnClientClick="JavaScript:AutoRefresh(5000);"

In Onclick event did call code behind function and call time off function in onclientclick event在 Onclick 事件中确实调用了函数背后的代码并在 onclientclick 事件中调用了 time off 函数

function AutoRefresh(t) {函数自动刷新(t){

        // setTimeout("location.reload(true);", t);
        setTimeout(function () { window.location = window.location; }, t);
    }

使用 window.location.href = window.location.href;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM