开发者

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

开发者 https://www.devze.com 2023-01-09 16:28 出处:网络
I have a file uploading and viewing page in ASP.Net 1.1 using VB. Now the page will be v开发者_运维问答isible in intranet as well internet. Here in my case the intranet and internet servers are differ

I have a file uploading and viewing page in ASP.Net 1.1 using VB. Now the page will be v开发者_运维问答isible in intranet as well internet. Here in my case the intranet and internet servers are different. 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?


I'd suggest that you have both instances of the application (intranet and internet) save their uploaded files to a common location. 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.

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. Having done that, you can map that location to a commonly named Virtual Directory on each of your two web servers as follows:

  1. Start "Internet Information Services (IIS) Manager" (Start > Control Panel > Administrative Tools)
  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
  5. Specify the path in the next step as something like \\192.168.100.1\SharedUploadFilesStore (i.e. wherever you've chosen to store the files
  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.
  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. 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:

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! =)

0

精彩评论

暂无评论...
验证码 换一张
取 消