Need to read a text file from a network share

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Scottie Boy
    New Member
    • Dec 2010
    • 1

    Need to read a text file from a network share

    Ok, I'm brand new to IIS and asp. (My experience is with apache on Solaris but we have gotten rid of that system.) I need to readin a text file with asp that is on the C: drive of another Windows server that is not running IIS. I created a share on folder containing the text file on the second server and made it available to the Everyone Group.

    The asp program, which works when the file is local, doesn't work when I modify the Server.MapPath line to use an UNC.

    Code:
    DispFile= Server.MapPath("\\190.232.176.10\\ArcGISLicenseLog\\ESRILicenseUse.txt")
    'DispFile= Server.MapPath("ESRILicenseUse.txt")
    Set FileObject = Server.CreateObject("Scripting.FileSystemObject") 
    Set InStream = FileObject.OpenTextFile (DispFile)
    From what I've read Server.MapPath doesn't work with those. How do I read a text file from a network share and is there any special permissions needed on the network share beyone the Everyone group?

    Thanks
  • Pheddy
    New Member
    • Dec 2008
    • 80

    #2
    Try mapping the network drive.

    Comment

    • danp129
      Recognized Expert Contributor
      • Jul 2006
      • 323

      #3
      I don't know for sure what problems you are going to run into as I haven't tried it and don't have the right environment to test, but here's my two cents:

      1) FSO does have the ability to open UNC paths as stated here. However, you may or may not have issues using the IUSR_MACHINENAM E or whatever account your site is running under accessing the other computer, just have to try and see.

      2) Server.MapPath shouldn't need to be used, you are already specifying the full path which is all that function returns.

      3) You should only have "\\" at the beginning of the UNC path, not after the folders.

      Comment

      Working...