简体   繁体   English

使用ASP.Net(VB)1.1将文件上传到远程服务器

[英]Uploading files to remote server using ASP.Net(VB) 1.1

I have a file uploading and viewing page in ASP.Net 1.1 using VB. 我在ASP.Net 1.1中使用VB上传和查看文件。 Now the page will be visible in intranet as well internet. 现在,该页面将在Intranet和Internet中可见。 Here in my case the intranet and internet servers are different. 在本例中,Intranet和Internet服务器是不同的。 How can i save the uploaded file in the intranet server and view from there subsequently when the activity is done using the internet server? 使用互联网服务器完成活动后,如何将上载的文件保存在Intranet服务器中并随后从那里查看?

I'd suggest that you have both instances of the application (intranet and internet) save their uploaded files to a common location. 我建议您同时拥有应用程序的两个实例(内部网和Internet),将其上传的文件保存到公共位置。 I'm going to assume, given that you're targeting .net 1.1 that you're probably looking for a solution/directions for IIS 6.0 or below, rather than the 7.x that comes with Vista/Server 2008. 假设您以.net 1.1为目标,那么您可能正在寻找IIS 6.0或更低版本的解决方案/说明,而不是Vista / Server 2008随附的7.x。

You need to firstly decide where you're going to store the uploaded files, it could be on the Intranet server, the Internet server or a 3rd "filestore" server. 您首先需要确定要在何处存储上载的文件,它可以在Intranet服务器,Internet服务器或第三台“文件存储”服务器上。 Having done that, you can map that location to a commonly named Virtual Directory on each of your two web servers as follows: 完成此操作后,可以将该位置映射到两个Web服务器中的每一个上的通用虚拟目录,如下所示:

  1. Start "Internet Information Services (IIS) Manager" (Start > Control Panel > Administrative Tools) 启动“ Internet信息服务(IIS)管理器”(“开始”>“控制面板”>“管理工具”)
  2. Expand the "Web Sites" node and find the virtual directory for your application 展开“网站”节点并找到您的应用程序的虚拟目录
  3. Right click on the virtual directory and choose "New" > "Virtual Directory..." 右键单击虚拟目录,然后选择“新建”>“虚拟目录...”
  4. In the wizard that appears, give the folder alias as something like SharedUploadFiles 在出现的向导中,为文件夹别名指定诸如SharedUploadFiles类的SharedUploadFiles
  5. Specify the path in the next step as something like \\\\192.168.100.1\\SharedUploadFilesStore (ie wherever you've chosen to store the files 在下一步中,将路径指定为\\\\192.168.100.1\\SharedUploadFilesStore类的路径(即,无论您选择存储文件的位置如何)
  6. The next step will require security credentials. 下一步将需要安全凭证。 Set these as a username and password that has read/write access (as appropriate) to the share you've specified in step 5. 将这些设置为对您在步骤5中指定的共享具有读/写访问权限的用户名和密码(视情况而定)。
  7. In the "Virtual Directory Access Permissions" step set the permissions as appropriate, click Next and then Finish. 在“虚拟目录访问权限”步骤中,适当地设置权限,单击“下一步”,然后单击“完成”。

Your application will now be able to access files in that share as if they were part of your web servers file system. 现在,您的应用程序将能够访问该共享中的文件,就像它们是Web服务器文件系统的一部分一样。 So, if you had a file located at \\\\192.168.100.1\\SharedUploadFilesStore\\sample.txt , you would then be able to access it through both: 因此,如果您的文件位于\\\\192.168.100.1\\SharedUploadFilesStore\\sample.txt ,则可以通过以下两种方式访问​​该文件:

http://internetdomain.name/MyWebAppName/SharedUploadFiles/sample.txt

and

http://intranet.mycompany.local/MyWebAppName/SharedUploadFiles/sample.txt

My knowledge of how to solve any issues you encounter whilst configuring this isn't that deep, and you'd probably get a better answer at http://www.serverfault.com/ as whilst your question is a programming one, the answer I've given isn't a programmatic solution (not that it always has to be! =) 我对如何解决在配置此程序时遇到的任何问题的了解并不深,您可能会在http://www.serverfault.com/上获得更好的答案,因为您的问题是编程问题,而答案是我给出的不是程序化解决方案(并非总是如此!=)

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

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