AsyncFileUpload *非常*在 AjaxControlToolkit 中被破坏
我刚刚从 codeplex 下载了新的 AjaxControlToolkit,以试用备受期待的 AsyncFileUpload 控件,但不幸的是它在第一个障碍时就失败了......
我将它放在一个名为 uploadFile.aspx 的相当简单的页面上,该页面带有 url 参数:
uploadFile.aspx?myDbId=1
在页面加载中,它正在使用 Request["myDbId"] 进行操作。
当使用新控件选择文件时,它会立即将其发回,但它会在 Request["myDbId"] 行中遇到 500 错误,因为它已删除所有 url 参数并将它们替换为自己的:
uploadFile.aspx?AsyncFileUploadID=ctl00_BodyPlaceHolder_ctl00&rnd=08382490910589695
这对我来说是一个这是一个大问题,我一直无法解决。有什么解决办法吗?
I've just downloaded the new AjaxControlToolkit from codeplex to give the much anticipated AsyncFileUpload control a go, but unfortunately it has fallen at the first hurdle...
I have put it on a fairly simple page called uploadFile.aspx which takes a url argument:
uploadFile.aspx?myDbId=1
In the page load, it's doing stuff with Request["myDbId"].
When selecting a file using the new control, it posts it back straight away, but it hits a 500 error with the Request["myDbId"] line because it has stripped ALL url arguments and replaced them for it's own:
uploadFile.aspx?AsyncFileUploadID=ctl00_BodyPlaceHolder_ctl00&rnd=08382490910589695
This to me is a massive problem, and one I haven't been able to get around. Any solutions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果该解决方案不起作用,这里有一个替代解决方案。这个解决方案已经存在了一两年了,这是他的第二个版本。它包括一个进度条,不需要闪存依赖性,并且可以毫无问题地处理非常大的文件。
ASP.Net文件上传模块v2
http://darrenjohnstone.net/aspnet-file-uploaddownload-module-v2 -文档/
Here's an alternate solution if that one doesn't work out. This solution has been around for a year or two, and it is his second version. It includes a progress bar that doesn't require a flash dependency, and can handle very large files without problems.
ASP.Net File Upload Module v2
http://darrenjohnstone.net/aspnet-file-uploaddownload-module-v2-documentation/
您可以使用会话变量来管理 myDbId 吗?
Can you use a Session variable to manage myDbId?
您可以对文件名中的 id 进行编码,因此只需将
"--" + myDbId
附加到文件名即可。事实上,它是在扩展之后出现的,这样可以更容易地知道它是被添加的。You could encode the id in the filename, so just append
"--" + myDbId
to the filename. The fact that it comes after the extension could make it easier to know that this was added.将 AsyncFileUpload 控件放入页面上的 iframe 中,该控件将回发到该部分。
Put the AsyncFileUpload control in an iframe on the page, which will post back to just that section.