简体   繁体   English

如何在内部Windows身份验证Intranet上允许多个文件上传?

[英]How do you allow multiple file uploads on an internal windows-authentication intranet?

I have a couple of solutions, but none of them work perfectly. 我有几个解决方案,但没有一个完美。

Platform 平台

  1. ASP.NET / VB.NET / .NET 2.0 ASP.NET / VB.NET / .NET 2.0
  2. IIS 6 IIS 6
  3. IE6 (primarily), with some IE7; IE6(主要是),带有一些IE7; Firefox not necessary, but useful Firefox不是必需的,但很有用

Allowed 3rd Party Options 允许第三方选项

  1. Flash
  2. ActiveX (would like to avoid) ActiveX(想避免)
  3. Java (would like to avoid) Java(想避免)

Current Attempts 目前的尝试

Gmail Style : You can use javascript to add new Upload elements (input type='file'), then upload them all at once with the click of a button. Gmail风格 :您可以使用javascript添加新的上传元素(输入类型='文件'),然后只需点击一下按钮即可立即上传所有内容。 This works, but still requires a lot of clicks. 这可行,但仍需要大量点击。 (I was able to use an invisible ActiveX control to detect things like File Size, which would be useful.) (我能够使用不可见的ActiveX控件来检测文件大小等内容,这将非常有用。)

Flash Uploader : I discovered a couple of Flash Upload controls that use a 1x1 flash file to act as the uploader, callable by javascript. Flash Uploader :我发现了一些Flash上​​传控件,它们使用1x1 flash文件作为上传器,可以通过javascript调用。 (One such control is FancyUpload , another is Dojo's Multiple File Uploader , yet another is one by darick_c at CodeProject .) These excited me, but I quickly ran into two issues: (一个这样的控件是FancyUpload ,另一个是Dojo的多文件上传器 ,另一个是CodeProjectdarick_c 。)这些令我兴奋,但我很快遇到了两个问题:

  1. Flash 10 will break the functionality that is used to call the multiple file upload dialogue box. Flash 10将破坏用于调用多文件上载对话框的功能。 The workaround is to use a transparent flash frame, or just use a flash button to call the dialogue box. 解决方法是使用透明闪光框,或只使用闪光按钮调用对话框。 That's not a huge deal. 这不是什么大不了的事。
  2. The integrated windows authentication used on our intranet is not used when the Flash file attempts to upload the files, prompting the user for credentials. 当Flash文件尝试上载文件时,不会使用我们Intranet上使用的集成Windows身份验证,从而提示用户输入凭据。 The workaround for this is to use cookieless sessions, which would be a nightmare for our project due to several other reasons. 解决方法是使用无cookie会话,由于其他几个原因,这对我们的项目来说是一场噩梦。

Java Uploader : I noticed several Java-based multiple-file uploaders, but most of the appear to cost money. Java Uploader :我注意到了几个基于Java的多文件上传器,但大多数都看起来要花钱。 If I found one that worked really well, I could arrange to purchase it. 如果我找到一个效果很好的,我可以安排购买它。 I'd just rather not. 我只是不愿意。 I also don't like the look of most of them. 我也不喜欢他们中的大多数人的样子。 I liked FancyUpload because it interacted with html/javascript so that I could easily style and manage it any way I want. 我喜欢FancyUpload,因为它与html / javascript进行了交互,因此我可以轻松地按照我想要的方式设置和管理它。

ActiveX Uploader : I found an ActiveX solution as well. ActiveX Uploader :我也找到了一个ActiveX解决方案 It appears that ActiveX will work. 似乎ActiveX将起作用。 I would just write my own instead of buying that one. 我会写自己的,而不是买那个。 This will be my last resort, I think. 我认为这将是我的最后手段。

Resolution 解析度

I would love to be able to use something like FancyUpload. 我希望能够使用像FancyUpload这样的东西。 If I can just get by the credentials prompt some way, it would be perfect. 如果我可以通过某种方式获取凭据提示,那将是完美的。 But, from my research, it appears that the only real workaround is cookieless sessions, which I just can't do. 但是,根据我的研究,似乎唯一真正的解决方法是无cookie会话,我不能这样做。

So, the question is: Is there a way to resolve the issues presented above OR is there a different solution that I have not listed which accomplishes the same goal? 所以,问题是:有没有办法解决上面提出的问题,还是有一个我没有列出的不同的解决方案可以实现相同的目标?

I don't think there is any work around for the integrated windows authentication. 我认为集成的Windows身份验证没有任何解决方法。 What you could possibly do is save the files to a generic unprotected folder and, in the case of swfupload, use a handler to move the file when its fully uploaded 您可能要做的是将文件保存到一般的不受保护的文件夹,并且在swfupload的情况下,使用处理程序在完全上载时移动文件

我们公司使用支持此功能的ajaxuploader.com。

您也可以尝试SWFUpload - 它适合您的Flash Uploader“类别”。

@davidinbcn.myopenid.co : That's basically how I solved this issue. @ davidinbcn.myopenid.co :基本上我是如何解决这个问题的。 But, in an effort to provide a more detailed answer, I'm posting my solution here. 但是,为了提供更详细的答案,我在这里发布我的解决方案。

The Solution! 解决方案!

Create two web applications, or websites, or whatever. 创建两个Web应用程序,或网站,或其他。

Application A is a simple web application. 应用程序A是一个简单的Web应用程序 The purpose of this application is to receive file uploads and save them to the proper place. 此应用程序的目的是接收文件上载并将其保存到适当的位置。 Set this up as an anonymous access allowed. 将其设置为允许的匿名访问。 Then make a single ASPX page that accepts posted files and saves them to a given location. 然后创建一个接受发布文件的ASPX页面并将其保存到给定位置。 (I'm doing this on an intranet. Internet sites may be exposing themselves to security issues by doing this. Take extra precautions if that is the case.) The code behind for this page would look something like this: (我在内联网上这样做。互联网网站可能通过这样做暴露自己的安全问题。如果是这种情况,请采取额外的预防措施。)此页面背后的代码如下所示:

Dim uploads As HttpFileCollection = HttpContext.Current.Request.Files
If uploads.Count > 0 Then
    UploadFiles(uploads)
Else
    result = "error"
    err = "File Not Uploaded"
End If

Application B is your primary site that will allow file uploads. 应用程序B是允许文件上载的主站点。 Set this up as an authenticated web application that does not allow anonymous access. 将其设置为不允许匿名访问的经过身份验证的Web应用程序。 Then, place the FancyUpload (or similar solution) on a page on this site. 然后,将FancyUpload (或类似解决方案)放在此站点的页面上。 Configure it to post its files to Application A's upload ASPX page. 配置它以将其文件发布到应用程序A的上载ASPX页面。

In Internet Explorer, FileReference.upload (flash upload) will send cookies along as well. 在Internet Explorer中,FileReference.upload(flash upload) 也会发送cookie。

This behavior breaks only when running in other browsers. 只有在其他浏览器中运行时,此行为才会中断

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM