当超链接下载“挂起”时,无限循环网页 [英] Infinite Looping web page when hyperlink download "hangs"

查看:92
本文介绍了当超链接下载“挂起”时,无限循环网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一位经理今天收到了7000次同样的电子邮件,而且他没有笑。帮助!



没有循环的网页如何进入无限循环?(Asp.Net C#)



我们有技术人员下载培训材料PDF,DOC等。

经理们想知道技术人员正在学习什么

所以在下载之前我给经理发了一封电子邮件。



一千个下载工作正常,然后一个似乎挂起(文件大小是随机的)



在这个挂起期间,同样的经理电子邮件无休止地发送

,直到技术人员放弃等待并取消下载。



没有代码循环,我看不出浏览器会如何导致循环...



要发送电子邮件,并保留链接页面,我使用两页。



Page 1有asp:带有TARGET的超链接打开一个新页面。

该页面始终是第2页(当我通过PDF时)路径)。



Page 2(循环)很简单:发送电子邮件,然后将response.redirect发送到下载文件。

技术人员看到新页面打开并开始下载。



我从来没有能够重现这个以进行调试。

我的try / catch或全局都没有错误。



感谢您的任何想法!

Steve

---------- -------------------------------------------------- -------------

更新1:我的代码涉及

(我尽力保持帖子简短......但是这是核心代码,如果有帮助的话)

技术人员说,可能是因为他的IE浏览器允许他在下载完成之前保存。但我无法通过该方法重现循环。

-------------------------------------- -----------------------------------

Page 1:一个超链接GridView

将路径/名称传递给名为bounce的页面

A manager got the same email 7000 times today and he's not smiling. HELP!

How can a web page without a loop, going into an infinite loop? (Asp.Net C#)

We have techs who download training material PDFs, DOCs etc.
The managers want to know what the techs are studying
so right before the download I send the manager an email.

A thousand downloads work fine, then one appears to "hang" (file size is random)

During this "hang" time, the same manager email is being sent endlessly
until the tech gives up waiting and cancels the download.

There are no code loops, I can't see how the browser would cause the loop...

To email, and leave the link page available, I use two pages.

Page 1 has asp:HyperLinks with a TARGET to open a new page.
That page is always Page 2 (while I pass PDF path).

Page 2 (looping) is simple: send the email, then response.redirect to the download file.
The tech sees a new page open and his download starts.

I have never been able to reproduce this for debugging.
I get no error in my try/catch or globally.

Thanks for any ideas out there!
Steve
-------------------------------------------------------------------------
Update 1: My code involved
(I was trying my best to keep the post short... but here's the core code if that helps)
Also the tech said, it may have happened when his IE browser allowed him to save before the download had completed. But I have not been able to reproduce the loop by that method.
-------------------------------------------------------------------------
Page 1: A HyperLink in a GridView
Pass the path/name to a page called "bounce"

<asp:HyperLink ID="hlBounce" runat="server"

    Text='<%# Eval("FileName") %>'

    NavigateUrl='<%# "~/private/training/courses/Bounce.aspx?pth="  +     Eval("FullPath") + "&nam=" + Eval("FileName")  %>'

    Target="_Blank" />



第2页:电子邮件并重定向到PDF


Page 2: Email and Redirect to PDF

protected void Page_Load(object sender, EventArgs e)
{
// Edited: Here I set my connection string, pull my parms from QueryString...
    if (sFilePath != "")
    {
        try
        {
            conn.Open();
            // This EmailMgr method just builds text, sqls manager address, 
            // and calls a generic class that sends email
            string sResult = EmailMgr(sFilePath);
        }
        catch (Exception ex)
        {
            eh.SaveErrorText(ex.Message.ToString(), ex.ToString(), sFilePath); 
        }
        finally
        {
            conn.Close();
        }
        Response.Redirect(sFilePath, false); // Used both true/false: same looping
    }
    Response.End(); // trying in vain to stop loop...
}

推荐答案

没有人可以在没有看到你的情况下修复你的代码。所以,我只能忽略你的观点,即无限循环的来源应该是代码中的某个循环。还有至少一个可能的原因:递归,这可能是非常间接的:

http://en.wikipedia.org/wiki/Recursion [ ^ ],

http://en.wikipedia.org/wiki / Recursion_(computer_science) [ ^ ] ,

http://en.wikipedia.org/wiki/Mutual_recursion [ ^ ]。



而且,在实践中,它可以是任何东西。再次,抱歉没有解决您的问题。我想,根据你的信息几乎不可能。



-SA
No one can fix your code without seeing it. So, I can only dismiss your idea that a the source of an "infinite" cycle should be some loop in code. There is at least one more possible reason: recursion, which can be very indirect:
http://en.wikipedia.org/wiki/Recursion[^],
http://en.wikipedia.org/wiki/Recursion_(computer_science)[^],
http://en.wikipedia.org/wiki/Mutual_recursion[^].

And, in practice, it can be anything. Again, sorry for not solving your problem. I guess, it's hardly possible based on your information.

—SA


这篇关于当超链接下载“挂起”时,无限循环网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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