troubleshooting Question

ASP ADODB.Stream LoadFromFile function does not work with network path ?

Avatar of synergiq
synergiqFlag for United Kingdom of Great Britain and Northern Ireland asked on
ASP
4 Comments1 Solution2862 ViewsLast Modified:
Hello there,

I am trying to stream a word document stored on a remote server in ASP but "The file could not be loaded" when the code below is executed.

However, if a use a physical path to a file stored on the webserver (C:\docs\ for instance), it will work just fine (of course the same .doc file was put in both folders).

Is there any workaround for this problem ? I bet I am not the first one that tried to do that.

Thanks in advance for input on that
'constant from another file put there
dim CONST_DOCPATH
 
'network path of the folder for the doc file
CONST_DOCPATH = "\\mimas\boss\"
 
'if i put CONST_DOCPATH = "C:\docs\" it will work just fine
 
dim strFile 
 
strFile = "1_1_1.doc"
'strFile = "testSETUP.doc"
strPath = CONST_DOCPATH
 
'response.Write strPath & strFile
 
'Set the content type to the specific type that you are sending.
Response.Buffer = True
Response.Clear
Response.ContentType = "application/msword"
Set objStream = Server.CreateObject("ADODB.Stream")
      objStream.Open
            objStream.Type = 1
            objStream.LoadFromFile strPath & strFile
            Response.BinaryWrite objStream.Read
      objStream.Close
Set objStream = Nothing
Response.End
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros