请等待ASP.NET MVC中的页面 [英] Please wait page in ASP.NET MVC
问题描述
页面执行许多任务,并且处理时间很长.我们希望在每个任务完成时向用户提供反馈.
A page executes a number of tasks and takes a long time to process. We want to give the user feedback as each task is completed.
在ASP.NET网络表单中,我们使用了Response.Flush()
In ASP.NET webforms we used Response.Flush()
您将以什么方式在ASP.NET MVC中进行这种处理?
What way would you a approach this in ASP.NET MVC?
推荐答案
您仍然可以将Response.Write()和Response.Flush()用作要通过网络发送的任何状态.或者,如果您在用户控件中遇到了麻烦,则可以执行以下操作:
You can still use Response.Write() and Response.Flush() for whatever status you want to send down the wire. Or if you have your progress thingy in a user-control, you could do something like:
this.PartialView("Progress").ExecuteResult(this.ControllerContext);
this.Response.Flush();
通过控制器的动作方法进行冗长的操作时从控制器中获取.
from your controller while doing your lengthy operation in the controller's action method.
您可以选择此处的注释中提到的这种方法或客户端方法,只是想指出服务器端仍然可行.
It's up to you to choose this or the client-side approach as mentioned in the comments here, just wanted to point out that server-side is still possible.
这篇关于请等待ASP.NET MVC中的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!