ASPX文件上传和故障排除解析不发送对页面的响应 [英] Troubleshooting ASPX file upload & parse not sending response to page

查看:60
本文介绍了ASPX文件上传和故障排除解析不发送对页面的响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了aspx永远不会响应文件上传的问题,即使逻辑完全运行。  场景:

I'm having an issue with a file upload in aspx never responding, even though the logic runs completely.  Scenario:

使用以下控件上传简单的aspx文件:

simple aspx file upload with the following control:

ASPX: <asp:FileUpload ID="FileUploadContent" runat="server" /> <asp:Button ID="btnContentUpload" runat="server" Text="Upload" OnClick="btnContentUpload_Click" /> Code Behind: protected void btnContentUpload_Click(object sender, EventArgs e) { if (FileUploadContent.HasFile) { string FileName = Path.GetFileName(FileUploadContent.PostedFile.FileName); string FilePath = Server.MapPath("..\\App_Data\\" + FileName); FileUploadContent.SaveAs(FilePath); ParseFile(FilePath); } } protected void ParseFile(string filePath) { try { FileStream stream = new FileStream(filePath, FileMode.Open); StreamReader reader = new StreamReader(stream); while (!reader.EndOfStream) {

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP;   string line = reader.ReadLine();

               string line = reader.ReadLine();

//解析文件

lblSuccessMssg.Text ="文件已成功上传";
}
catch(exception ex)
{
lblErrorMssg.Text ="读取文件时出错。 " + ex.Message;
}
}
}

lblSuccessMssg.Text = "File uploaded successfully"; } catch (Exception ex) { lblErrorMssg.Text = "Error reading file. " + ex.Message; } } }




我遇到的问题是页面永远不会响应,并永远说"等待{server} ..."在状态栏中。  您可以进入App_Data文件夹并查看文件已被复制,您可以打开一个新的浏览器/选项卡转到随附的报告
以查看数据实际已上传,但上传页面本身永远不会回应。

The problem I'm having is that the page never responds, and forever says "waiting on {server}..." in the status bar.  You can go into the App_Data folder and see the file was copied, and you can open a new browser/tab to go to the accompanying report to see that the data was in fact uploaded, however the upload page itself never responds.

现在,这个问题只发生在所有浏览器的客户端。  我自己无法重现此问题,所以我想知道可能导致排除故障的可能原因。

Now, this issue is only happening on the clients end, in all browsers.  I have not been able to reproduce the issue myself, so I am wondering what probable causes there might be to troubleshoot.

编辑:显示读者。 ReadLine()所以人们不认为我有一个无限循环。

Show reader.ReadLine() so people don't think I have an infinite loop.

推荐答案

我认为问题出在 ParseFile ,永远不会结束。您在
循环时执行了哪些操作?
I think the problem is in the ParseFile, that never ends. What action do you perform in the while loop?


这篇关于ASPX文件上传和故障排除解析不发送对页面的响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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