Link to home
Start Free TrialLog in
Avatar of MPDeveloper
MPDeveloperFlag for United States of America

asked on

Connection to remote file server to stream files through IIS problem.

I am currently switching from IIS5 to IIS6 (Win2k -> Win2k3). I have an application that MUST have the files streamed from a internal protected server with a firewall between the two servers. This is a must due to contractual security agreements.

The firewall is properly set up, as well as the persistant route to the remote server. Through Explorer on the web server I have the ability to connect to the remote server, map drives, transfer files, etc... However, I cannot seem to get any access to the files when called through my ASP application.

This bit of code works wonderfully on our old server (IIS5) but I can't get it to work on the new one (IIS6).

Here is the code I am using.

**********BEGIN ASP CODE IN VBScript*********************

                sFullFileName = "\\192.168.#.#\Streaming\[filename].pdf"
                Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
                If objFSO.FileExists(sFullFileName) Then
                                    
                        Response.Expires = -10000
                        Response.ContentType = "application/pdf"
                        Response.AddHeader "Content-Type","application/pdf"
                        Response.AddHeader "Content-Disposition","inline;filename="&id&".pdf"
             
                        set m_objBinaryFile = server.CreateObject("BinaryFileStream.Object")
                        Response.BinaryWrite m_objBinaryFile.GetFileBytes(cstr(sFullFileName))
                        set m_objBinaryFile = nothing
            Else
                      response.Write("No report is available for this period.")
                  
            End If

**********END ASP CODE IN VBScript*********************

We use this code in other applications where the filename points to a location ON the server. (ex. { sFullFileName = "F:\PDF_Files\Streaming\[filename].pdf"}) and the code works as it should and finds all of the files.

The code fails at the .FileExists (can't find the file) when trying to open files from the remote server. Trying to open the file directly without this check returns a file not found error.

I do not believe it is a permission issue because I tested both the IUSR_ and IWAM_ along with the Network Services set with Admin priveleges, and that did not work either.

I feel this has to be an IIS issue because the code works in other applications and I CAN access the remote server from Explorer from the web server.

Summary-----
1. ASP code CANNOT access remote server
2. Explorer on web server CAN access remote server
3. Network Services with Admin rights CANNOT access remote server through code
4. Code works when pointed to files stored on web server.

Thanks in advance for your help!
ASKER CERTIFIED SOLUTION
Avatar of dnojcd
dnojcd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MPDeveloper

ASKER

Just finished setting up the server.

That worked wonderfully - thanks for your help and quick response!