473,546 Members | 2,244 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

LoadFromFile using a mapped network drive

15 New Member
Hello everyone

I'm creating an ASP classic application that let's users download and save PDF files without having to bring them up in the browser. I have successfully used the LoadFromFile method to perform this feat but not in the manner in which I ultimately want things to be.

Currently the PDF's sit on the server itself, but I would like for these to be on a different computer. When I try to set up this scenario, the LoadFromFile method can never find the file.

My first thought was to Map a network drive to the location of the PDF's on the other computer. Still, LoadFromFile can't find the files.

Is there any way to use LoadFromFile on the server, but have the file I'm looking for reside on a diffrent computer on the same network?
Here is my logic....

Where I set the CompletePath variable, "S:" is the mapped network drive.

Expand|Select|Wrap|Line Numbers
  1. If Len(Trim(Session("MEMBER_ID"))) > 0 Then
  2.     Response.Clear
  3.     Response.contentType = "application/octet-stream"
  4.     Response.addheader "content-disposition", "attachment; filename=" & FileName
  5.  
  6.     Set Stream = server.CreateObject("ADODB.Stream")
  7.  
  8.     Stream.Type = adTypeBinary
  9.     Stream.Open
  10.  
  11.     CompletePath = "S:\Inetpub\wwwroot\PDF\" & GroupName & "\" & FileName
  12.  
  13.     Stream.LoadFromFile CompletePath 
  14.     While Not Stream.EOS
  15.         Response.BinaryWrite Stream.Read(1024 * 64)
  16.     Wend
  17.  
  18.     Stream.Close
  19.     Set Stream = Nothing
  20.  
  21.     'Response.write("<html>")
  22.     'Response.write(CompletePath)
  23.     'Response.write("</html>")
  24.  
  25.     Response.Flush
  26.     Response.End
  27. End If
  28.  
Thanks a million!!!!!! Any help would be wonderful. :)
Apr 5 '08 #1
6 5852
danp129
323 Recognized Expert Contributor
Try loading the full UNC path "\\servername\s harename\subfol der\filename.ex t" and make sure the file has read rights given to the "IUSR_wwwserver " user account.
Apr 7 '08 #2
cryogeneric
15 New Member
Hi danp129, Thanks so much for the response.

The web server will vpn to a computer behind the firewall that contains the files. So by "servername ", I'm assuming IP address will be fine.

In other words: \\100.100.100.1 \pdf\somefile.p df

Theoretically, I don't see any reason why this shouldn't work. The path shouldn't matter if the server can read from the folder (which it can). But it doesn't work. :(

The PDF folder is currently shared, AND I turned on "web sharing".
Apr 9 '08 #3
cryogeneric
15 New Member
Solved!

While for whatever reason I'm unable to run LoadFromFile and read from a folder on a different computer, I was able to solve the problem by placing the script that calls the LoadFromFile method on the Network computer and calling THE SCRIPT using the IP address.

I guess LoadFromFile is unable to read from a folder that is not physically on the computer that the script is called from. Seems weird, but trust me, I spent hours trying to get it to work.
Apr 9 '08 #4
DrBunchman
979 Recognized Expert Contributor
That's interesting. The FileSystem object has a similar drawback where the Exists property always returns false if you use it on a file stored on a different machine. This is a good solution though to call a script running on the remote server.

Glad you got it sorted.

Dr B
Apr 10 '08 #5
cryogeneric
15 New Member
Thanks.

That's good to know about the FileExists method. I suspect this solution could be used to get around that problem as well. Of course, IIS needs to be setup on the remote server.

In fact, now that I think about... I wonder if you could "include" a script on the remote server which has subs that call FileExists or LoadFromFile... hmmm

I might have to test that someday. :)
Apr 10 '08 #6
danp129
323 Recognized Expert Contributor
I think the problem with mapped drives is that mapped drives are user specific and IUSR_ doesn't have any mapped drives.
Apr 11 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

14
8694
by: Curtis Tammany | last post by:
Hello- Can someone tell me if DSOFile.dll can be accessed within ASP.NET? DSOFile.dll is registered and I have no problem using it in my .ASP scripts. I have tried the following: Dim oFilePropReader As DSOleFile.PropertyReader Dim oFileProperties As oFilePropReader.GetDocumentProperties("C:\MyDoc.doc") Response.write ("<table>" &...
1
971
by: PeterNZ | last post by:
Hi all, I developped an C# app which is using FileSystemWatcher. If a file is created in a specific folder, it opens the file and does some processing. This functionality works without problems in the following scenarios: In a Winform App, pointing at a Local Folder In a Winform App, pointing at a mapped network Folder In a Winform App,...
5
21542
by: Niloday | last post by:
Hi All, I am trying to access a mapped network drive from a service that I have created. The service needs to create/delete folders/files on a network drive. When I tried to connect to a folder on mapped network drive (eg. N:\Storage that corresponds to \\FS1NS\SharedDir\), I get an error as "Could not find part of path N:\".
5
4449
by: Nirosh | last post by:
Hi All, Can any one suggest me a best way to do this .. I have a thrid party tool "EXE" that we need to use with our web service to manipulate some complex XML files, which reside in a seperate files server. we have mapped the fodler to a different folder and need to allow the EXE to process on the mapped drive. When I trigger the EXE via...
2
4734
by: createdbyx | last post by:
I am trying to make a file sync utillity to sync files between my laptop and my desktop pc. On my desktop machine (xp pro sp2) I have shared my "Visual Studio Projects" folder using windows simple file sharing. And have specified the "Allow network users to change my files." option as well. Then on my laptop (xp home sp2) I have mapped a...
4
11723
by: sajid_yusuf | last post by:
Hi I am trying to develop a Windows service in VB.NET which has timer enabled and keeps checking a folder (or group of folders) for any new file or changed files. As soon as it detects any new file or changes (to files or folders) then it copies the files (and any new folders) to a folder in the mapped network drive. So far I have been...
1
2546
by: dkultasev | last post by:
Hello, I developed the program for multi use. The program reads data from the text file and puts modified data back to another file. This program was uploaded to mapped network drive. When I try to run this program from my computer (doesn't matter if it is on my local drive or on mapped one) the program runs ok. When somebody else trying to...
24
3660
by: =?Utf-8?B?QnJpYW4gTmljaG9sc29u?= | last post by:
Hello, I'm trying to create an admin page that can run miscellaneous scripts for our IT department. Currently, I'm trying to create a script that can map a network drive for a user (e.g. a form where I can input \\path\folder, drive letter, and domain\user). Is this possible? If so, can someone point me in the right direction? Thank you,...
2
3511
by: =?Utf-8?B?SGF6ZWxyYWg=?= | last post by:
I posted this question on a different website but I didn't get a response that worked. If I run this code from my computers hard drive, C:\, it detects the networked mapped drive, J:\, just fine: Private Function FolderExists() As Boolean Return My.Computer.FileSystem.DirectoryExists("J:\Template_Alpha\") End Function '...
0
7507
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7435
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7698
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7794
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1922
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.