如何在上传包含.net中超过1个lac记录的大表单时重定向另一个页面。 [英] How to redirect another page while uploading large sheet which contains more than 1 lac record in .net.

查看:39
本文介绍了如何在上传包含.net中超过1个lac记录的大表单时重定向另一个页面。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在上传包含超过1个lac记录的大型工作表时重定向另一个页面。

在此期间,上传过程正在运行,我们可以看到其他页面并执行一些操作其他页面上的任务。



我尝试过:



这个问题在采访中被问到。

解决方案

我认为你' 期望您上传到服务器以便在另一个线程中发生并赢得 t,因为它' 执行实际的HTTP请求并将数据发送到服务器。我假设上传是花费时间而不是新线程中的逻辑,HTTP请求的速度取决于服务器和上传方之间的连接速度以及服务器可以存储的速度信息。 

你的附加线程 只是对已发送到服务器的文件的最终处理 - 将其移动到文件系统上的 else 并创建上载图像的缩略图。当您点击线程创建时,该文件已经发送到服务器。

如果您' 还没有这样做,我建议使用AJAX发送上传请求请求将在幕后执行异步 ' 并赢得让您的用户留意在冻结的屏幕上,同时发生 20 第二次上传

问题 ,Ajax上传需要iFrame和各种奇特的技术来确保它 与所有浏览器兼容。我不会' 除非您愿意,否则请自行完成此操作,但我使用以下插件进行上传的所有内容网站,它就像一个魅力:http://malsup.com/jquery/form/

我使用的方法是ajaxSubmit(),它使用AJAX以及任何< input type =提交你的表单file/>字段。


我和我的同事问了同样的问题,他告诉我我们可以通过使用Delegates调用异步方法来处理它。请查看以下详细信息以供参考。



代表的一个有用功能是能够异步执行方法。也就是说,通过委托,您可以开始调用方法,然后在委托在单独的线程中执行其方法时立即返回。您的页面执行不需要等待该方法完成。



欲了解更多信息,请参阅以下链接。

使用代理以异步方式在C#中调用方法 [ ^ ]

How to just redirect another page while uploading large sheet which contains more than 1 lac record in .Net.
During this, upload process is running as well as we can see other pages and do some task on other pages.

What I have tried:

This question was asked in interview.

解决方案

I think that you're expecting your upload to the server to happen in another thread and it won't because it's performing an actual HTTP request and sending the data to your server. I assume that it is the upload that is taking the time and not the logic within the new thread, the speed of the HTTP request is dependent on the connection speed between the server and the uploading party and the speed at which your server can store the information.

What you're doing in your additional thread is just the final processing of the file that has been sent to the server - moving it somewhere else on the file system and creating a thumbnail of the uploaded image. By the time you hit your new thread creation, the file has already been sent to the server.

If you're not doing this already, I suggest sending the upload request using an AJAX request which will execute asynchronously 'behind the scenes' and won't leave your users looking at a frozen screen whilst a 20 second upload is taking place.

The problem is that Ajax uploads require an iFrame and all sorts of fancy techniques to ensure that it is compatible with all browsers. I wouldn't bother doing this yourself unless you want to, but I use the following plugin for all of the uploads on my site and it works like a charm: http://malsup.com/jquery/form/

The method I use is ajaxSubmit() which submits your form using AJAX along with any <input type="file" /> fields.


I asked same question with my colleague and he told me that we can handle it with by calling asynchronous method using Delegates. Please find below details for your reference.

A useful feature of delegates is the ability to execute a method asynchronously. That is, through a delegate, you can begin invocation of a method and then return immediately while the delegate executes its method in a separate thread. Your page execution does not need to wait for that method to complete.

For more information please refer below link.
Calling a method in C# asynchronously using delegates[^]


这篇关于如何在上传包含.net中超过1个lac记录的大表单时重定向另一个页面。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆